Skip to content

Build and Deploy

Build and Deploy #62

name: Build and Deploy
on:
push:
branches:
- main
jobs:
build:
name: build
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: "21.x"
distribution: "temurin"
cache: 'gradle'
- name: test and build
run: ./gradlew test build
env:
ORG_GRADLE_PROJECT_githubPassword: ${{ secrets.GITHUB_TOKEN }}
- name: build docker image
uses: nais/docker-build-push@v0
id: docker-build-push
with:
team: tbd
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
outputs:
image: ${{ steps.docker-build-push.outputs.image }}
deploy:
needs: build
name: deploy
strategy:
fail-fast: false
matrix:
cluster:
- dev-gcp
- prod-gcp
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: deploy
uses: nais/deploy/actions/deploy@v2
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
RESOURCE: .nais/nais.yml
IMAGE: ${{ needs.build.outputs.image }}
CLUSTER: ${{ matrix.cluster }}
VARS: .nais/${{ matrix.cluster }}.yml