Skip to content

Commit

Permalink
refactor: Optimize release build workflow version handling
Browse files Browse the repository at this point in the history
- Move version detection to docker job output
- Use job outputs to share version across manifest creation steps
- Simplify version tagging and manifest generation
- Remove redundant version retrieval step
  • Loading branch information
tphakala committed Feb 21, 2025
1 parent c9b95d2 commit e8c9637
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ jobs:
docker:
if: ${{ !contains(github.ref, 'nightly') && (github.event_name == 'release' || github.event_name == 'workflow_dispatch') }}
runs-on: ubuntu-24.04
outputs:
version: ${{ steps.get_version.outputs.version }}
strategy:
matrix:
platform: [linux/amd64, linux/arm64]
Expand Down Expand Up @@ -163,7 +165,7 @@ jobs:
with:
images: ghcr.io/${{ env.REPO }}
tags: |
type=raw,value={{version}}-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
type=raw,value=${{ steps.get_version.outputs.version }}-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
type=raw,value=${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
- name: Build and push Docker image
Expand All @@ -184,13 +186,6 @@ jobs:
needs: docker
runs-on: ubuntu-24.04
steps:
- name: Get version
id: get_version
run: |
VERSION=$(git describe --tags --always)
echo "VERSION=${VERSION}" >> ${GITHUB_ENV}
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
Expand All @@ -205,10 +200,10 @@ jobs:
- name: Create and push manifest
run: |
# Create and push the versioned manifest
docker manifest create ghcr.io/${{ env.REPO }}:${{ steps.get_version.outputs.version }} \
ghcr.io/${{ env.REPO }}:${{ steps.get_version.outputs.version }}-amd64 \
ghcr.io/${{ env.REPO }}:${{ steps.get_version.outputs.version }}-arm64
docker manifest push ghcr.io/${{ env.REPO }}:${{ steps.get_version.outputs.version }}
docker manifest create ghcr.io/${{ env.REPO }}:${{ needs.docker.outputs.version }} \
ghcr.io/${{ env.REPO }}:${{ needs.docker.outputs.version }}-amd64 \
ghcr.io/${{ env.REPO }}:${{ needs.docker.outputs.version }}-arm64
docker manifest push ghcr.io/${{ env.REPO }}:${{ needs.docker.outputs.version }}
# Create and push the latest manifest
docker manifest create ghcr.io/${{ env.REPO }}:latest \
Expand Down

0 comments on commit e8c9637

Please sign in to comment.