|
| 1 | +# Workflow: Build and Push Staging Docker Container |
| 2 | +# Description: Builds and pushes amd64-only staging image for Auth on every main merge. |
| 3 | +# Why: Provides a :staging floating tag and immutable :sha-* tags for pre-release validation, |
| 4 | +# completely separate from the :latest production tags pushed by build-and-push.yml. |
| 5 | + |
| 6 | +name: Staging Package Manager |
| 7 | + |
| 8 | +on: |
| 9 | + push: |
| 10 | + branches: |
| 11 | + - main |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +concurrency: |
| 15 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 16 | + cancel-in-progress: true |
| 17 | + |
| 18 | +env: |
| 19 | + REGISTRY: ghcr.io |
| 20 | + IMAGE_NAME: ${{ github.repository }} |
| 21 | + |
| 22 | +jobs: |
| 23 | + build-auth: |
| 24 | + # Skip commits pushed by the release bot (chore(release): vX.Y.Z commits from release.yml) |
| 25 | + if: github.actor != 'github-actions[bot]' |
| 26 | + runs-on: ubuntu-latest |
| 27 | + permissions: |
| 28 | + contents: read |
| 29 | + packages: write |
| 30 | + |
| 31 | + steps: |
| 32 | + - name: Checkout repository |
| 33 | + uses: actions/checkout@v6 |
| 34 | + with: |
| 35 | + fetch-depth: 0 |
| 36 | + |
| 37 | + - name: Create .env file |
| 38 | + run: cp .env.sample .env |
| 39 | + |
| 40 | + - name: Set up Docker Buildx |
| 41 | + uses: docker/setup-buildx-action@v3 |
| 42 | + with: |
| 43 | + driver-opts: | |
| 44 | + image=moby/buildkit:latest |
| 45 | + network=host |
| 46 | +
|
| 47 | + - name: Log in to the Container registry |
| 48 | + uses: docker/login-action@v3 |
| 49 | + with: |
| 50 | + registry: ${{ env.REGISTRY }} |
| 51 | + username: ${{ github.actor }} |
| 52 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 53 | + |
| 54 | + - name: Extract metadata for Auth |
| 55 | + id: meta-auth |
| 56 | + uses: docker/metadata-action@v5 |
| 57 | + with: |
| 58 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 59 | + tags: | |
| 60 | + type=raw,value=staging |
| 61 | + type=sha,prefix=sha-,format=short |
| 62 | +
|
| 63 | + - name: Build and push Auth image |
| 64 | + uses: docker/build-push-action@v6 |
| 65 | + with: |
| 66 | + context: . |
| 67 | + platforms: linux/amd64 |
| 68 | + push: true |
| 69 | + tags: ${{ steps.meta-auth.outputs.tags }} |
| 70 | + labels: ${{ steps.meta-auth.outputs.labels }} |
| 71 | + cache-from: type=gha,scope=staging-auth |
| 72 | + cache-to: type=gha,mode=max,scope=staging-auth |
| 73 | + provenance: false |
0 commit comments