From c586bd365afe837553004695032160d5b7af271a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amalie=20Mans=C3=A5ker?= Date: Wed, 12 Jul 2023 13:37:56 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=9A=20Oppdaterer=20github=20workflow?= =?UTF-8?q?=20til=20=C3=A5=20bygge=20backend?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Markus A. R. Johansen Co-authored-by: Hege Haavaldsen Co-authored-by: Helene Arnesen Co-authored-by: Øydis Kind Refsum --- .github/workflows/build-and-deploy.yml | 34 ++++++++++++++------------ 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index d18a32c..bd3258d 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -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" \ No newline at end of file + "RESOURCE": "nais.yml" \ No newline at end of file