Build container #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publishing | |
on: | |
push: | |
branches: | |
- develop | |
- release/* | |
- hotfix/* | |
tags: | |
- v*.*.* | |
env: | |
REGISTRY: ghcr.io | |
jobs: | |
formatting: | |
name: Check formatting | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: '21' | |
cache: gradle | |
- name: Run Spotless | |
run: ./gradlew --no-daemon spotlessCheck | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
environment: test | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: '21' | |
cache: gradle | |
- name: Build emails | |
run: make emails | |
- name: Run tests | |
run: ./gradlew --no-daemon test | |
env: | |
MP_JWT_VERIFY_PUBLICKEY: ${{ vars.MP_JWT_VERIFY_PUBLICKEY }} | |
SMALLRYE_JWT_SIGN_KEY: ${{ secrets.SMALLRYE_JWT_SIGN_KEY }} | |
APP_URL: https://api.fyreplace.example.org | |
APP_FRONT_URL: https://fyreplace.example.org | |
APP_WEBSITE_URL: https://www.fyreplace.example.org | |
build: | |
name: Build | |
needs: test | |
runs-on: ubuntu-latest | |
environment: container | |
permissions: | |
contents: read | |
packages: write | |
attestations: write | |
id-token: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
- name: Login to registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
- name: Extract metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ github.repository }} | |
tags: | | |
type=sha | |
type=ref,event=branch | |
type=edge,branch=develop | |
type=semver,pattern={{version}} | |
- name: Setup Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push Docker image | |
id: push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Generate artifact attestation | |
uses: actions/attest-build-provenance@v1 | |
with: | |
subject-name: ${{ env.REGISTRY }}/${{ github.repository}} | |
subject-digest: ${{ steps.push.outputs.digest }} | |
push-to-registry: true |