Build - eux-pdf-flattener #23
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: build | |
run-name: Build - ${{ github.event.head_commit.message }} | |
permissions: | |
deployments: write | |
packages: write | |
contents: write | |
id-token: write | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
env: | |
APP_NAME: eux-pdf-flattener | |
IMAGE: ghcr.io/${{ github.repository }}/eux-pdf-flattener | |
READER_TOKEN: ${{ secrets.READER_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up java 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 21 | |
distribution: 'temurin' | |
cache: 'maven' | |
- name: Build and test | |
run: > | |
mvn clean install | |
--settings ./.github/settings.xml | |
--no-transfer-progress -B | |
- name: Set Image Name | |
run: > | |
echo "DOCKER_IMAGE=${IMAGE}:${{ github.sha }}" >> $GITHUB_ENV | |
- name: Build docker image | |
run: > | |
docker build -t ${IMAGE}:${{ github.sha }} . | |
- name: Login to Github Package Registry | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: > | |
docker login ghcr.io -u ${GITHUB_REPOSITORY} -p ${GITHUB_TOKEN} | |
- name: Push Docker image | |
run: > | |
docker push ${IMAGE}:${{ github.sha }} | |
outputs: | |
docker-image: > | |
${{ env.IMAGE }}:${{ github.sha }} | |
dry-run-q2: | |
name: 'Dry run to NAIS - Q2' | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 'Calling deploy action (eessibasis namespace)' | |
uses: nais/deploy/actions/deploy@v2 | |
env: | |
DRY_RUN: true | |
CLUSTER: dev-gcp | |
RESOURCE: .nais/nais.yaml | |
VAR: image=${{ needs.build.outputs.docker-image }} | |
VARS: .nais/q2.yaml | |
PRINT_PAYLOAD: true | |
dry-run-q1: | |
name: 'Dry run to NAIS - Q1' | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 'Calling deploy action (eessibasis namespace)' | |
uses: nais/deploy/actions/deploy@v2 | |
env: | |
DRY_RUN: true | |
CLUSTER: dev-gcp | |
RESOURCE: .nais/nais.yaml | |
VAR: image=${{ needs.build.outputs.docker-image }} | |
VARS: .nais/q1.yaml | |
PRINT_PAYLOAD: true | |
dry-run-prod: | |
name: 'Dry run to NAIS - Production' | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 'Calling deploy action (eessibasis namespace)' | |
uses: nais/deploy/actions/deploy@v2 | |
env: | |
DRY_RUN: true | |
CLUSTER: prod-gcp | |
RESOURCE: .nais/nais.yaml | |
VAR: image=${{ needs.build.outputs.docker-image }} | |
VARS: .nais/prod.yaml | |
PRINT_PAYLOAD: true |