|
1 | 1 | name: Build multi-arch Docker Image |
2 | 2 |
|
3 | 3 | on: |
| 4 | + release: |
| 5 | + types: [published] |
4 | 6 | push: |
5 | 7 | branches: [main] |
6 | 8 | pull_request: |
7 | 9 |
|
| 10 | +env: |
| 11 | + IMAGE_REPOSITORY: testcontainers/vnc-recorder |
| 12 | + |
8 | 13 | jobs: |
9 | 14 | build: |
10 | 15 | runs-on: ubuntu-latest |
11 | 16 | steps: |
12 | | - - uses: actions/checkout@v3 |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - name: Login to Docker Hub |
| 20 | + # Only if we need to push an image |
| 21 | + if: ${{ github.event_name == 'release' && github.event.action == 'published' }} |
| 22 | + uses: docker/login-action@v3 |
| 23 | + with: |
| 24 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 25 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
13 | 26 |
|
| 27 | + - name: Login to Github Container Registry |
| 28 | + # Only if we need to push an image |
| 29 | + if: ${{ github.event_name == 'release' && github.event.action == 'published' }} |
| 30 | + uses: docker/login-action@v3 |
| 31 | + with: |
| 32 | + registry: ghcr.io |
| 33 | + username: ${{ github.actor }} |
| 34 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 35 | + |
| 36 | + # Setup for buildx |
14 | 37 | - name: Set up QEMU |
15 | | - uses: docker/setup-qemu-action@v2 |
| 38 | + uses: docker/setup-qemu-action@v3 |
| 39 | + |
16 | 40 | - name: Set up Docker Buildx |
17 | 41 | id: buildx |
18 | | - uses: docker/setup-buildx-action@v2 |
| 42 | + uses: docker/setup-buildx-action@v3 |
19 | 43 |
|
| 44 | + # Debugging information |
20 | 45 | - name: Docker info |
21 | 46 | run: docker info |
| 47 | + |
22 | 48 | - name: Buildx inspect |
23 | 49 | run: docker buildx inspect |
24 | 50 |
|
| 51 | + # Build and (optionally) push the image |
25 | 52 | - name: Build image |
26 | | - uses: docker/build-push-action@v3 |
| 53 | + uses: docker/build-push-action@v6 |
27 | 54 | with: |
28 | 55 | context: . |
29 | 56 | file: ./Dockerfile |
30 | 57 | platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x |
31 | | - push: false |
| 58 | + push: ${{ github.event_name == 'release' && github.event.action == 'published' }} |
32 | 59 | # Use a 'temp' tag, that won't be pushed, for non-release builds |
33 | | - tags: testcontainers/vnc-recorder:${{ github.event.release.tag_name || 'temp' }} |
| 60 | + tags: | |
| 61 | + ${{ env.IMAGE_REPOSITORY }}:${{ github.event.release.tag_name || 'temp' }} |
| 62 | + ghcr.io/${{ env.IMAGE_REPOSITORY }}:${{ github.event.release.tag_name || 'temp' }} |
0 commit comments