diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 50109b76d..2d7bf40d9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,6 +24,7 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 + - uses: docker/setup-qemu-action@v3 - uses: docker/setup-buildx-action@v2 - uses: docker/login-action@v2 with: @@ -33,11 +34,11 @@ jobs: - uses: docker/build-push-action@v4 with: push: true - tags: ghcr.io/postalserver/postal:ci-${{ github.sha }} + tags: ghcr.io/${{ github.repository_owner }}/postal:ci-${{ github.sha }} cache-from: type=gha cache-to: type=gha,mode=max target: ci - platforms: linux/amd64 + platforms: linux/amd64,linux/arm64 test: name: Test Suite @@ -54,10 +55,10 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - run: docker compose pull env: - POSTAL_IMAGE: ghcr.io/postalserver/postal:ci-${{ github.sha }} + POSTAL_IMAGE: ghcr.io/${{ github.repository_owner }}/postal:ci-${{ github.sha }} - run: docker compose run postal sh -c 'bundle exec rspec' env: - POSTAL_IMAGE: ghcr.io/postalserver/postal:ci-${{ github.sha }} + POSTAL_IMAGE: ghcr.io/${{ github.repository_owner }}/postal:ci-${{ github.sha }} release-branch: name: Release (branch) @@ -80,12 +81,15 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - id: info run: | - IMAGE=ghcr.io/postalserver/postal + IMAGE=ghcr.io/${{ github.repository_owner }}/postal REF="${GITHUB_REF#refs/heads/}" if [ -z "$REF" ]; then exit 1; fi - VER="$(git describe --tags 2>/dev/null)" + # Sanitize branch name for Docker tags (replace / with -) + SAFE_REF="${REF//\//-}" + + VER="$(git describe --tags 2>/dev/null || echo 'dev')" echo "version=${VER}" >> "$GITHUB_OUTPUT" echo "branch=${REF}" >> "$GITHUB_OUTPUT" @@ -93,7 +97,7 @@ jobs: if [[ "$REF" == "main" ]]; then echo "${IMAGE}:latest" >> "$GITHUB_OUTPUT" else - echo "${IMAGE}:branch-${REF}" >> "$GITHUB_OUTPUT" + echo "${IMAGE}:branch-${SAFE_REF}" >> "$GITHUB_OUTPUT" fi echo 'EOF' >> "$GITHUB_OUTPUT" - uses: docker/build-push-action@v4 @@ -103,7 +107,7 @@ jobs: cache-from: type=gha cache-to: type=gha,mode=max target: full - platforms: linux/amd64 + platforms: linux/amd64,linux/arm64 build-args: | VERSION=${{ steps.info.outputs.version }} BRANCH=${{ steps.info.outputs.branch }} @@ -126,11 +130,11 @@ jobs: with: push: true tags: | - ghcr.io/postalserver/postal:stable - ghcr.io/postalserver/postal:${{ needs.release-please.outputs.version }} + ghcr.io/${{ github.repository_owner }}/postal:stable + ghcr.io/${{ github.repository_owner }}/postal:${{ needs.release-please.outputs.version }} cache-from: type=gha cache-to: type=gha,mode=max target: full build-args: | VERSION=${{ needs.release-please.outputs.version }} - platforms: linux/amd64 + platforms: linux/amd64,linux/arm64