💚 Oppdaterer github workflow til å bygge backend
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>
This commit is contained in:
parent
b2f90e0508
commit
c586bd365a
1 changed files with 18 additions and 16 deletions
34
.github/workflows/build-and-deploy.yml
vendored
34
.github/workflows/build-and-deploy.yml
vendored
|
@ -4,24 +4,21 @@ on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- "main"
|
- "main"
|
||||||
env:
|
|
||||||
"IMAGE": "ghcr.io/${{ github.repository }}:${{ github.sha }}"
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: frontend
|
|
||||||
jobs:
|
jobs:
|
||||||
"build":
|
"build":
|
||||||
name: "build"
|
name: "build"
|
||||||
runs-on: "ubuntu-latest"
|
runs-on: "ubuntu-latest"
|
||||||
steps:
|
steps:
|
||||||
- uses: "actions/checkout@v3"
|
- uses: "actions/checkout@v3"
|
||||||
- uses: "actions/setup-node@v3"
|
- uses: "actions/setup-java@v3"
|
||||||
with:
|
with:
|
||||||
node-version: "18"
|
distribution: "temurin"
|
||||||
- name: "Install dependencies"
|
java-version: "17.x"
|
||||||
run: "yarn"
|
cache: "gradle"
|
||||||
- name: "Build app"
|
- name: "Build and test"
|
||||||
run: "yarn run build"
|
uses: "gradle/gradle-build-action@v2"
|
||||||
|
with:
|
||||||
|
arguments: :frontend:build :backend:test :backend:build
|
||||||
- name: "Login to GitHub Docker Registry"
|
- name: "Login to GitHub Docker Registry"
|
||||||
uses: "docker/login-action@v1"
|
uses: "docker/login-action@v1"
|
||||||
with:
|
with:
|
||||||
|
@ -29,11 +26,16 @@ jobs:
|
||||||
"username": "${{ github.actor }}"
|
"username": "${{ github.actor }}"
|
||||||
"password": "${{ secrets.GITHUB_TOKEN }}"
|
"password": "${{ secrets.GITHUB_TOKEN }}"
|
||||||
- name: "Build and push Docker"
|
- name: "Build and push Docker"
|
||||||
uses: "docker/build-push-action@v2"
|
uses: "nais/docker-build-push@v0"
|
||||||
|
id: docker-build-push
|
||||||
with:
|
with:
|
||||||
context: frontend
|
team: "helse-sprik"
|
||||||
tags: "${{ env.IMAGE }}"
|
cache_from: type=gha
|
||||||
push: "true"
|
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":
|
"deploy":
|
||||||
name: "Deploy app"
|
name: "Deploy app"
|
||||||
needs: "build"
|
needs: "build"
|
||||||
|
@ -45,4 +47,4 @@ jobs:
|
||||||
env:
|
env:
|
||||||
"APIKEY": "${{ secrets.NAIS_DEPLOY_APIKEY }}"
|
"APIKEY": "${{ secrets.NAIS_DEPLOY_APIKEY }}"
|
||||||
"CLUSTER": "dev-gcp"
|
"CLUSTER": "dev-gcp"
|
||||||
"RESOURCE": "frontend/nais.yml"
|
"RESOURCE": "nais.yml"
|
Reference in a new issue