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