|
| 1 | +# This workflow uses actions that are not certified by GitHub. |
| 2 | +# They are provided by a third-party and are governed by |
| 3 | +# separate terms of service, privacy policy, and support |
| 4 | +# documentation. |
| 5 | + |
| 6 | +# GitHub recommends pinning actions to a commit SHA. |
| 7 | +# To get a newer version, you will need to update the SHA. |
| 8 | +# You can also reference a tag or branch, but the action may change without warning. |
| 9 | + |
| 10 | +name: Publish Docker image |
| 11 | + |
| 12 | +on: |
| 13 | + release: |
| 14 | + types: [published] |
| 15 | + |
| 16 | +jobs: |
| 17 | + push_to_registry: |
| 18 | + name: Push Docker image to Docker Hub |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - name: Check out the repo |
| 22 | + uses: actions/checkout@v3 |
| 23 | + |
| 24 | + - |
| 25 | + name: Set up QEMU |
| 26 | + uses: docker/setup-qemu-action@v2 |
| 27 | + |
| 28 | + - |
| 29 | + name: Set up Docker Buildx |
| 30 | + uses: docker/setup-buildx-action@v2 |
| 31 | + |
| 32 | + - name: Log in to Docker Hub |
| 33 | + uses: docker/login-action@v2 |
| 34 | + with: |
| 35 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 36 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 37 | + |
| 38 | + - name: Extract metadata (tags, labels) for Docker |
| 39 | + id: meta |
| 40 | + uses: docker/metadata-action@v4 |
| 41 | + with: |
| 42 | + images: ${{ github.repository }} |
| 43 | + |
| 44 | + - name: Build and push Docker image |
| 45 | + uses: docker/build-push-action@v3 |
| 46 | + with: |
| 47 | + context: . |
| 48 | + platforms: linux/amd64,linux/arm64 |
| 49 | + push: true |
| 50 | + tags: ${{ steps.meta.outputs.tags }} |
| 51 | + labels: ${{ steps.meta.outputs.labels }} |
0 commit comments