|
| 1 | +name: docker push |
| 2 | +on: |
| 3 | + release: |
| 4 | + types: |
| 5 | + - created |
| 6 | + |
| 7 | +jobs: |
| 8 | + docker: |
| 9 | + permissions: |
| 10 | + contents: read |
| 11 | + packages: write |
| 12 | + |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Set up QEMU |
| 16 | + uses: docker/setup-qemu-action@v3 |
| 17 | + |
| 18 | + - name: Set up Docker Buildx |
| 19 | + uses: docker/setup-buildx-action@v3 |
| 20 | + |
| 21 | + - name: Docker meta |
| 22 | + id: meta |
| 23 | + uses: docker/metadata-action@v5 |
| 24 | + with: |
| 25 | + # list of Docker images to use as base name for tags |
| 26 | + images: | |
| 27 | + etilite/qr-coder |
| 28 | + flavor: | |
| 29 | + latest=false |
| 30 | + tags: | |
| 31 | + type=raw,value=development,enable=${{ github.event_name != 'release' }} |
| 32 | + type=raw,value=latest,enable=${{ github.event_name == 'release' }} |
| 33 | + type=semver,pattern={{version}} |
| 34 | + type=semver,pattern={{major}}.{{minor}} |
| 35 | + type=sha,enable=true,priority=100,prefix=,suffix=,format=short |
| 36 | +
|
| 37 | + - name: Login to DockerHub |
| 38 | + uses: docker/login-action@v3 |
| 39 | + with: |
| 40 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 41 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 42 | + |
| 43 | + - name: Build the Docker image and push |
| 44 | + uses: docker/build-push-action@v5 |
| 45 | + with: |
| 46 | + file: ./build/Dockerfile |
| 47 | + platforms: linux/amd64,linux/arm64 |
| 48 | + push: true |
| 49 | + tags: ${{ steps.meta.outputs.tags }} |
| 50 | + labels: ${{ steps.meta.outputs.labels }} |
| 51 | + build-args: | |
| 52 | + GIT_REF=${{ github.sha }} |
| 53 | + cache-from: type=gha |
| 54 | + cache-to: type=gha,mode=min |
| 55 | + |
0 commit comments