|
| 1 | +name: Build & Push Image |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + |
| 7 | +env: |
| 8 | + USERNAME: ${{ github.repository_owner }} |
| 9 | + IMAGE_NAME: ${{ github.repository }} |
| 10 | + REGISTRY: ghcr.io |
| 11 | + |
| 12 | +jobs: |
| 13 | + update: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Checkout Repository |
| 18 | + uses: actions/checkout@v4 |
| 19 | + |
| 20 | + - name: Login to Registry |
| 21 | + uses: docker/login-action@v3 |
| 22 | + with: |
| 23 | + registry: ${{ env.REGISTRY }} |
| 24 | + username: ${{ env.USERNAME }} |
| 25 | + password: ${{ secrets.GH_PCKG_TOKEN }} |
| 26 | + |
| 27 | + - name: Setup QEMU |
| 28 | + uses: docker/setup-qemu-action@v3 |
| 29 | + |
| 30 | + - name: Setup Buildx |
| 31 | + uses: docker/setup-buildx-action@v3 |
| 32 | + |
| 33 | + - name: Extract Labels and Tags |
| 34 | + id: meta |
| 35 | + uses: docker/metadata-action@v5 |
| 36 | + with: |
| 37 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 38 | + flavor: | |
| 39 | + latest=false |
| 40 | + tags: | |
| 41 | + type=semver,pattern=v{{major}} |
| 42 | + type=semver,pattern=v{{version}} |
| 43 | + type=semver,pattern=v{{major}}.{{minor}} |
| 44 | + type=semver,pattern=latest |
| 45 | +
|
| 46 | + - name: Build and Push Image |
| 47 | + uses: docker/build-push-action@v6 |
| 48 | + with: |
| 49 | + context: . |
| 50 | + platforms: linux/amd64, linux/arm64 |
| 51 | + tags: ${{ steps.meta.outputs.tags }} |
| 52 | + labels: ${{ steps.meta.outputs.labels }} |
| 53 | + push: true |
0 commit comments