💚 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:
|
||||
branches:
|
||||
- "main"
|
||||
env:
|
||||
"IMAGE": "ghcr.io/${{ github.repository }}:${{ github.sha }}"
|
||||
defaults:
|
||||
run:
|
||||
working-directory: frontend
|
||||
jobs:
|
||||
"build":
|
||||
name: "build"
|
||||
runs-on: "ubuntu-latest"
|
||||
steps:
|
||||
- uses: "actions/checkout@v3"
|
||||
- uses: "actions/setup-node@v3"
|
||||
- uses: "actions/setup-java@v3"
|
||||
with:
|
||||
node-version: "18"
|
||||
- name: "Install dependencies"
|
||||
run: "yarn"
|
||||
- name: "Build app"
|
||||
run: "yarn run build"
|
||||
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:
|
||||
|
@ -29,11 +26,16 @@ jobs:
|
|||
"username": "${{ github.actor }}"
|
||||
"password": "${{ secrets.GITHUB_TOKEN }}"
|
||||
- name: "Build and push Docker"
|
||||
uses: "docker/build-push-action@v2"
|
||||
uses: "nais/docker-build-push@v0"
|
||||
id: docker-build-push
|
||||
with:
|
||||
context: frontend
|
||||
tags: "${{ env.IMAGE }}"
|
||||
push: "true"
|
||||
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"
|
||||
|
@ -45,4 +47,4 @@ jobs:
|
|||
env:
|
||||
"APIKEY": "${{ secrets.NAIS_DEPLOY_APIKEY }}"
|
||||
"CLUSTER": "dev-gcp"
|
||||
"RESOURCE": "frontend/nais.yml"
|
||||
"RESOURCE": "nais.yml"
|
Reference in a new issue