a32ba9b045
Co-authored-by: Markus A. R. Johansen <markus.aleksander.rakil.johansen@nav.no> Co-authored-by: Hege Haavaldsen <hege.haavaldsen@nav.no> Co-authored-by: Helene Arnesen <helene.arnesen@nav.no> Co-authored-by: Øydis Kind Refsum <oydis.kind.refsum@nav.no> Co-authored-by: Christian Bulow Skovborg <christian.bulow.skovborg@nav.no>
54 lines
No EOL
1.6 KiB
YAML
54 lines
No EOL
1.6 KiB
YAML
name: "Build and deploy app"
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- "main"
|
|
jobs:
|
|
build:
|
|
name: "build"
|
|
runs-on: "ubuntu-latest"
|
|
permissions:
|
|
contents: "read"
|
|
id-token: "write"
|
|
steps:
|
|
- uses: "actions/checkout@v3"
|
|
- uses: "actions/setup-java@v3"
|
|
with:
|
|
distribution: "temurin"
|
|
java-version: "17.x"
|
|
cache: "gradle"
|
|
- name: "Build and test"
|
|
uses: "gradle/gradle-build-action@v2"
|
|
with:
|
|
arguments: :frontend:build :backend:test :backend:build
|
|
- name: "Login to GitHub Docker Registry"
|
|
uses: "docker/login-action@v1"
|
|
with:
|
|
"registry": "ghcr.io"
|
|
"username": "${{ github.actor }}"
|
|
"password": "${{ secrets.GITHUB_TOKEN }}"
|
|
- name: "Build and push Docker"
|
|
uses: "nais/docker-build-push@v0"
|
|
id: docker-build-push
|
|
with:
|
|
team: "helse-sprik"
|
|
cache_from: type=gha
|
|
cache_to: type=gha,mode=max
|
|
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
|
|
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
|
|
outputs:
|
|
image: ${{ steps.docker-build-push.outputs.image }}
|
|
"deploy":
|
|
name: "Deploy app"
|
|
needs: "build"
|
|
runs-on: "ubuntu-latest"
|
|
steps:
|
|
- uses: "actions/checkout@v3"
|
|
- name: "Deploy app"
|
|
uses: "nais/deploy/actions/deploy@v1"
|
|
env:
|
|
"APIKEY": "${{ secrets.NAIS_DEPLOY_APIKEY }}"
|
|
"CLUSTER": "dev-gcp"
|
|
"RESOURCE": "nais.yml"
|
|
"IMAGE": "${{ needs.build.outputs.image }}" |