|
1 | | -name: Build and Push Docker image |
| 1 | +name: Dashboard Docker Buildx Workflow |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | pull_request: |
5 | 5 | types: [closed] |
6 | 6 | branches: |
7 | 7 | - main |
| 8 | + - development |
| 9 | + release: |
| 10 | + types: [published, edited] |
8 | 11 |
|
9 | 12 | jobs: |
10 | | - build: |
| 13 | + build_pr: |
| 14 | + if: github.event_name == 'pull_request' && github.event.pull_request.merged == true |
11 | 15 | runs-on: ubuntu-latest |
12 | | - if: github.event.pull_request.merged == true |
13 | 16 | steps: |
14 | 17 | - name: Checkout code |
15 | | - uses: actions/checkout@v3.5.3 |
| 18 | + uses: actions/checkout@v4.1.1 |
16 | 19 |
|
17 | 20 | - name: Set up QEMU |
18 | | - uses: docker/setup-qemu-action@v2.2.0 |
| 21 | + uses: docker/setup-qemu-action@v3 |
19 | 22 |
|
20 | 23 | - name: Set up Docker Buildx |
21 | | - |
22 | | - with: |
23 | | - version: latest |
| 24 | + |
24 | 25 |
|
25 | 26 | - name: Login to DockerHub |
26 | | - uses: docker/login-action@v2.2.0 |
| 27 | + uses: docker/login-action@v3 |
27 | 28 | with: |
28 | 29 | username: ${{ secrets.DOCKERHUB_USERNAME }} |
29 | 30 | password: ${{ secrets.DOCKERHUB_TOKEN }} |
30 | 31 |
|
31 | | - - name: Build and push |
32 | | - id: docker_build |
33 | | - |
| 32 | + - name: Build and push Development Image |
| 33 | + if: github.base_ref == 'development' |
| 34 | + uses: docker/build-push-action@v5 |
| 35 | + with: |
| 36 | + context: . |
| 37 | + platforms: linux/amd64,linux/arm64 |
| 38 | + push: true |
| 39 | + tags: hummingbot/dashboard:development |
| 40 | + |
| 41 | + - name: Build and push Latest Image |
| 42 | + if: github.base_ref == 'main' |
| 43 | + uses: docker/build-push-action@v5 |
34 | 44 | with: |
35 | 45 | context: . |
| 46 | + file: ./Dockerfile |
| 47 | + platforms: linux/amd64,linux/arm64 |
36 | 48 | push: true |
37 | 49 | tags: hummingbot/dashboard:latest |
| 50 | + |
| 51 | + build_release: |
| 52 | + if: github.event_name == 'release' |
| 53 | + runs-on: ubuntu-latest |
| 54 | + steps: |
| 55 | + - name: Checkout code |
| 56 | + |
| 57 | + |
| 58 | + - name: Set up QEMU |
| 59 | + uses: docker/setup-qemu-action@v3 |
| 60 | + |
| 61 | + - name: Set up Docker Buildx |
| 62 | + |
| 63 | + |
| 64 | + - name: Login to DockerHub |
| 65 | + uses: docker/login-action@v3 |
| 66 | + with: |
| 67 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 68 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 69 | + |
| 70 | + - name: Extract tag name |
| 71 | + id: get_tag |
| 72 | + run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/} |
| 73 | + |
| 74 | + - name: Build and push |
| 75 | + uses: docker/build-push-action@v5 |
| 76 | + with: |
| 77 | + context: . |
38 | 78 | platforms: linux/amd64,linux/arm64 |
39 | | - build-args: | |
40 | | - BRANCH=${{ github.ref }} |
41 | | - COMMIT=${{ github.sha }} |
42 | | - BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') |
43 | | - cache-from: type=registry,ref=hummingbot/dashboard:latest |
44 | | - cache-to: type=inline |
45 | | - |
46 | | - - name: Image digest |
47 | | - run: echo ${{ steps.docker_build.outputs.digest }} |
| 79 | + push: true |
| 80 | + tags: hummingbot/dashboard:${{ steps.get_tag.outputs.VERSION }} |
0 commit comments