From bac78426a4db968f39d1b42435c65f2a8a03112f Mon Sep 17 00:00:00 2001 From: Bryan Brooks Date: Mon, 9 Mar 2026 11:52:01 -0500 Subject: [PATCH] ci: add GitHub Actions release workflow for GHCR Builds multi-arch Docker image (amd64 + arm64) and pushes to ghcr.io/cache8063/atauth-gateway on version tag push. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/release.yml | 70 +++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..5c41ffc --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,70 @@ +name: Release + +on: + push: + tags: + - 'v*' + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository_owner }}/atauth-gateway + +permissions: + contents: read + packages: write + +jobs: + test: + name: Test + runs-on: ubuntu-latest + defaults: + run: + working-directory: gateway + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '20' + - run: npm ci + - run: npm run typecheck + - run: npm run lint + - run: npm run test:run + + build-and-push: + name: Build and Push Docker Image + runs-on: ubuntu-latest + needs: [test] + steps: + - uses: actions/checkout@v4 + + - name: Extract version from tag + id: meta + run: | + VERSION=${GITHUB_REF_NAME#v} + SHORT_SHA=$(echo "$GITHUB_SHA" | cut -c1-7) + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + echo "short_sha=$SHORT_SHA" >> "$GITHUB_OUTPUT" + + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: ./gateway + platforms: linux/amd64,linux/arm64 + push: true + build-args: | + BUILD_COMMIT=${{ steps.meta.outputs.short_sha }} + tags: | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }} + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest + cache-from: type=gha + cache-to: type=gha,mode=max -- 2.51.2