fix: gh push on push event with latest tag was not using latest as ta… #9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_REPO: ${{ format('{0}/{1}', 'ghcr.io', github.repository) }} | |
| IMAGE_TAG: ${{ github.event_name == 'pull_request' && format('pr-{0}-{1}', github.event.number, github.sha) || github.sha }} | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: amd64 | |
| runner: ubuntu-24.04 | |
| - arch: arm64 | |
| runner: ubuntu-24.04-arm | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build image (${{ matrix.arch }}) | |
| env: | |
| IMAGE_TAG: ${{ env.IMAGE_TAG }}-${{ matrix.arch }} | |
| run: | | |
| make oci-build | |
| - name: Push image (${{ matrix.arch }}) | |
| if: github.event_name == 'push' | |
| env: | |
| IMAGE_TAG: ${{ env.IMAGE_TAG }}-${{ matrix.arch }} | |
| run: | | |
| make oci-push | |
| manifest: | |
| if: github.event_name == 'push' | |
| needs: build | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create and push manifest | |
| run: | | |
| make oci-manifest-build | |
| make oci-manifest-push | |
| - name: Tag as latest (main branch only) | |
| run: | | |
| make oci-tag | |
| make oci-push | |
| env: | |
| IMAGE_SOURCE_TAG: ${{ env.IMAGE_TAG }} | |
| IMAGE_TAG: latest |