Hotfix: Det ser ut til at journalpost 628245791 er riktig ferdigstilt… #687
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-ignore: | |
- 'dependabot/**' | |
env: | |
IMAGE: ghcr.io/${{ github.repository }}/dp-mottak:${{ github.sha }} | |
jobs: | |
build: | |
name: Build and publish Docker image | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
- name: Setup gradle dependency cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', 'buildSrc/src/main/kotlin/Constants.kt') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Build with Gradle | |
run: ./gradlew build --info | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
builder: ${{ steps.buildx.outputs.name }} | |
tags: ${{ env.IMAGE }},${{ env.LATEST_IMAGE }} | |
push: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
deploy-dev: | |
name: Deploy to dev | |
needs: [build] | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
environment: dev-gcp | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: nais/deploy/actions/deploy@v1 | |
env: | |
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
CLUSTER: dev-gcp | |
RESOURCE: .nais/nais.yaml | |
VARS: .nais/dev-vars.yaml | |
PRINT_PAYLOAD: true | |
deploy-prod: | |
name: Deploy to Production | |
needs: [build] | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
environment: prod-gcp | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: nais/deploy/actions/deploy@v1 | |
env: | |
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
CLUSTER: prod-gcp | |
RESOURCE: .nais/nais.yaml | |
VARS: .nais/prod-vars.yaml | |
PRINT_PAYLOAD: true |