Leser dbConfig og dbUser fra Secrets-filer uten .sh #5
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 and deploy | |
on: | |
push: | |
branches: | |
- 'master' | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: 'Miljø' | |
required: true | |
default: 'q2' | |
type: choice | |
options: | |
- q1 | |
- q2 | |
- p | |
env: | |
ENVIRONMENT: ${{ github.event.inputs.environment }} | |
jobs: | |
build: | |
name: Build and publish Docker image | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v3 | |
- name: Build application | |
run: ./gradlew build | |
- name: Build and publish Docker image | |
uses: nais/docker-build-push@v0 | |
id: docker-build-push | |
with: | |
team: meldekort | |
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} | |
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} | |
outputs: | |
image: ${{ steps.docker-build-push.outputs.image }} | |
deploy-dev: | |
if: github.event.inputs.environment != 'p' | |
name: Deploy to dev | |
needs: [ build ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set default environment for push to main | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
run: echo 'ENVIRONMENT=q2' >> $GITHUB_ENV | |
- uses: actions/checkout@v4 | |
- uses: nais/deploy/actions/deploy@v2 | |
env: | |
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
CLUSTER: dev-fss | |
RESOURCE: .nais/nais.yaml | |
VAR: image=${{ needs.build.outputs.image }} | |
VARS: .nais/vars-${{ env.ENVIRONMENT }}.yaml | |
deploy-prod: | |
if: github.event.inputs.environment == 'p' | |
name: Deploy to prod | |
needs: [ build ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: nais/deploy/actions/deploy@v2 | |
env: | |
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
CLUSTER: prod-fss | |
RESOURCE: .nais/nais.yaml | |
VAR: image=${{ needs.build.outputs.image }} | |
VARS: .nais/vars-${{ env.ENVIRONMENT }}.yaml |