diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index c929157..cbb30df 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -44,7 +44,7 @@ jobs: type=ref,event=pr type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} - type=sha + type=sha,prefix=,suffix=,format=short type=raw,value=latest,enable={{is_default_branch}} - name: Set up Python @@ -68,65 +68,36 @@ jobs: cache-from: type=gha cache-to: type=gha,mode=max - - name: Build individual architecture images - if: github.event_name != 'pull_request' + - name: Create additional tags for releases + if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') run: | - # Build amd64 image - docker buildx build \ - --platform linux/amd64 \ - --tag ghcr.io/stackvista/agent-integrations-finder:${{ github.sha }}-amd64 \ - --push \ - . + # Get short SHA (8 characters) + SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-8) + VERSION_TAG="${{ github.ref_name }}" - # Build arm64 image + echo "Creating additional version tags: $VERSION_TAG" + + # Create architecture-specific version tags docker buildx build \ - --platform linux/arm64 \ - --tag ghcr.io/stackvista/agent-integrations-finder:${{ github.sha }}-arm64 \ + --platform linux/amd64,linux/arm64 \ + --tag ghcr.io/stackvista/agent-integrations-finder:$VERSION_TAG-amd64 \ + --tag ghcr.io/stackvista/agent-integrations-finder:$VERSION_TAG-arm64 \ + --file Dockerfile \ --push \ . - - # Add version tags if this is a release (tag push) - if [[ "${{ github.ref }}" == refs/tags/* ]]; then - VERSION_TAG="${{ github.ref_name }}" - echo "Creating version tags: $VERSION_TAG" - - # Tag amd64 image with version - docker tag ghcr.io/stackvista/agent-integrations-finder:${{ github.sha }}-amd64 \ - ghcr.io/stackvista/agent-integrations-finder:$VERSION_TAG-amd64 - docker push ghcr.io/stackvista/agent-integrations-finder:$VERSION_TAG-amd64 - - # Tag arm64 image with version - docker tag ghcr.io/stackvista/agent-integrations-finder:${{ github.sha }}-arm64 \ - ghcr.io/stackvista/agent-integrations-finder:$VERSION_TAG-arm64 - docker push ghcr.io/stackvista/agent-integrations-finder:$VERSION_TAG-arm64 - fi - - - name: Create multi-architecture manifest - if: github.event_name != 'pull_request' - run: | - # Create manifest with git SHA - docker buildx imagetools create -t ghcr.io/stackvista/agent-integrations-finder:${{ github.sha }} \ - ghcr.io/stackvista/agent-integrations-finder:${{ github.sha }}-amd64 \ - ghcr.io/stackvista/agent-integrations-finder:${{ github.sha }}-arm64 - - # Create manifest with version tag if this is a release - if [[ "${{ github.ref }}" == refs/tags/* ]]; then - VERSION_TAG="${{ github.ref_name }}" - echo "Creating version manifest: $VERSION_TAG" - docker buildx imagetools create -t ghcr.io/stackvista/agent-integrations-finder:$VERSION_TAG \ - ghcr.io/stackvista/agent-integrations-finder:$VERSION_TAG-amd64 \ - ghcr.io/stackvista/agent-integrations-finder:$VERSION_TAG-arm64 - fi - name: Show image info run: | + # Get short SHA (8 characters) + SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-8) + echo "Built images:" docker images ghcr.io/stackvista/agent-integrations-finder || true echo "" echo "Available tags:" - echo "- ghcr.io/stackvista/agent-integrations-finder:${{ github.sha }}" - echo "- ghcr.io/stackvista/agent-integrations-finder:${{ github.sha }}-amd64" - echo "- ghcr.io/stackvista/agent-integrations-finder:${{ github.sha }}-arm64" + echo "- ghcr.io/stackvista/agent-integrations-finder:$SHORT_SHA" + echo "- ghcr.io/stackvista/agent-integrations-finder:$SHORT_SHA-amd64" + echo "- ghcr.io/stackvista/agent-integrations-finder:$SHORT_SHA-arm64" if [[ "${{ github.ref_name }}" != "${{ github.sha }}" ]]; then echo "- ghcr.io/stackvista/agent-integrations-finder:${{ github.ref_name }}" echo "- ghcr.io/stackvista/agent-integrations-finder:${{ github.ref_name }}-amd64"