Release - mdc #51
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: release | |
run-name: Release - ${{ github.event.head_commit.message }} | |
permissions: | |
deployments: write | |
packages: write | |
contents: write | |
id-token: write | |
on: | |
push: | |
branches: [ main ] | |
concurrency: release | |
env: | |
APP_NAME: eux-journal | |
READER_TOKEN: ${{ secrets.READER_TOKEN }} | |
DATABASE_HOST: localhost | |
DATABASE_PORT: 5432 | |
DATABASE_DATABASE: postgres | |
DATABASE_USERNAME: postgres | |
DATABASE_PASSWORD: postgres | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
build: | |
name: 'Build' | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:14 | |
env: | |
POSTGRES_PASSWORD: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
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: Setup Git User | |
uses: fregante/setup-git-user@v2 | |
- name: Set Next Version | |
run: > | |
mvn eux-versions:set-next -B -e -U --settings ./.github/settings.xml | |
-DnewVersion=${{ github.event.inputs.version }} | |
--no-transfer-progress | |
- name: Extract New Version | |
id: versions | |
run: > | |
echo "version=$(mvn -q --no-transfer-progress --settings ./.github/settings.xml | |
-Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)" >> $GITHUB_OUTPUT | |
- name: Test and build | |
run: > | |
mvn clean package scm:tag -B -e -U | |
--settings ./.github/settings.xml | |
--no-transfer-progress | |
- name: Push docker image to GAR | |
uses: nais/docker-build-push@v0 | |
id: docker-build-push | |
with: | |
team: eessibasis | |
tag: ${{ steps.versions.outputs.version }} | |
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} | |
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} | |
- name: Echo Version | |
run: echo "### Version ${{ steps.versions.outputs.version }}" >> $GITHUB_STEP_SUMMARY | |
outputs: | |
docker-image: > | |
${{ steps.docker-build-push.outputs.image }} | |
deploy-q1: | |
name: 'Deploy to q1' | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 'Calling nais deploy action for q1' | |
uses: nais/deploy/actions/deploy@v2 | |
env: | |
CLUSTER: dev-gcp | |
RESOURCE: .nais/nais.yaml | |
VAR: image=${{ needs.build.outputs.docker-image }} | |
VARS: .nais/q1.yaml | |
PRINT_PAYLOAD: true | |
deploy-q2: | |
name: 'Deploy to q2' | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 'Calling nais deploy action for q2' | |
uses: nais/deploy/actions/deploy@v2 | |
env: | |
CLUSTER: dev-gcp | |
RESOURCE: .nais/nais.yaml | |
VAR: image=${{ needs.build.outputs.docker-image }} | |
VARS: .nais/q2.yaml | |
PRINT_PAYLOAD: true | |
# Endret feilhåndtering, avventer litt produksjon | |
# prod: | |
# name: 'Deploy to prod' | |
# runs-on: ubuntu-latest | |
# needs: [build, deploy-q1, deploy-q2] | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - name: 'Calling nais deploy action for prod' | |
# uses: nais/deploy/actions/deploy@v2 | |
# env: | |
# CLUSTER: prod-gcp | |
# RESOURCE: .nais/nais.yaml | |
# VAR: image=${{ needs.build.outputs.docker-image }} | |
# VARS: .nais/prod.yaml | |
# PRINT_PAYLOAD: true |