Opprett praksisendring 2024 tabell (#1079) #877
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build-Deploy-Prod-GCP | |
on: | |
push: | |
branches: | |
- 'main' | |
jobs: | |
bygg-og-kjor-tester: | |
name: Bygg og test | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: "21" | |
distribution: 'temurin' | |
cache: 'maven' | |
- name: Bygg | |
env: | |
GITHUB_USERNAME: x-access-token | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: mvn verify -B --no-transfer-progress --settings .m2/maven-settings.xml --file pom.xml -Dsurefire.rerunFailingTestsCount=2 | |
bygg-og-push-til-github: | |
name: Bygg app/image, push til github | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: "21" | |
distribution: 'temurin' | |
cache: 'maven' | |
- name: Bygg | |
env: | |
GITHUB_USERNAME: x-access-token | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: mvn verify -B --no-transfer-progress --settings .m2/maven-settings.xml --file pom.xml -DskipTests | |
- uses: nais/docker-build-push@v0 | |
id: docker-push | |
with: | |
pull: true | |
team: teamfamilie | |
tag: latest | |
push_image: true | |
dockerfile: Dockerfile | |
docker_context: . | |
byosbom: target/classes/META-INF/sbom/application.cdx.json | |
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} | |
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} | |
outputs: | |
image: ${{ steps.docker-push.outputs.image }} | |
deploy-til-preprod: | |
name: Deploy to dev-gcp | |
needs: [ bygg-og-kjor-tester, bygg-og-push-til-github ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: nais/deploy/actions/deploy@v2 | |
env: | |
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
CLUSTER: dev-gcp | |
RESOURCE: .deploy/nais/app-preprod.yaml | |
IMAGE: ${{ needs.bygg-og-push-til-github.outputs.image }} | |
deploy-til-prod: | |
name: Deploy til prod-gcp | |
needs: [ bygg-og-kjor-tester, bygg-og-push-til-github ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: nais/deploy/actions/deploy@v2 | |
env: | |
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
CLUSTER: prod-gcp | |
RESOURCE: .deploy/nais/app-prod.yaml | |
IMAGE: ${{ needs.bygg-og-push-til-github.outputs.image }} |