Prøv å håndtere utnulling av samtalereferat (#904) #166
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: Deploy gcp dev og prod | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: deploy_prod | |
cancel-in-progress: true | |
env: | |
PRINT_PAYLOAD: true | |
jobs: | |
test-build-and-push: | |
permissions: | |
contents: read | |
id-token: write | |
name: Test, build and push | |
runs-on: ubuntu-latest | |
outputs: | |
image: ${{ steps.docker-build-push.outputs.image }} | |
telemetry: ${{ steps.docker-build-push.outputs.telemetry }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 21 | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Execute Gradle build | |
run: ./gradlew build --scan | |
- name: Slack Notification (test failure) | |
if: failure() | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_COLOR: danger | |
SLACK_USERNAME: Github Actions | |
SLACK_ICON: https://github.com/github.png?size=48 | |
SLACK_TITLE: 'Veilarbaktivitet: tester feilet under deploy til prod' | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_MESSAGE: 'Commit-message til feilende deploy: ${{ github.event.head_commit.message }}' | |
- name: Push docker image to GAR | |
uses: nais/docker-build-push@v0 | |
id: docker-build-push | |
with: | |
team: dab | |
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} # Provided as Organization Secret | |
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} # Provided as Organization Variable | |
env: | |
TRIVY_JAVA_DB_REPOSITORY: "public.ecr.aws/aquasecurity/trivy-java-db:1" | |
deploy-dev: | |
name: Deploy application to dev | |
needs: test-build-and-push | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Deploy application to dev | |
uses: nais/deploy/actions/deploy@v2 | |
env: | |
CLUSTER: dev-gcp | |
RESOURCE: nais/nais-dev-gcp.yaml | |
VAR: image=${{ needs.test-build-and-push.outputs.image }} | |
TELEMETRY: ${{ needs.test-build-and-push.outputs.telemetry }} | |
deploy-prod: | |
name: Deploy application to prod | |
needs: [test-build-and-push, deploy-dev] | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Deploy application to prod | |
uses: nais/deploy/actions/deploy@v2 | |
env: | |
CLUSTER: prod-gcp | |
RESOURCE: nais/nais-prod-gcp.yaml | |
VAR: image=${{ needs.test-build-and-push.outputs.image }} | |
TELEMETRY: ${{ needs.test-build-and-push.outputs.telemetry }} | |
- name: Slack Notification (deploy failure) | |
if: failure() | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_COLOR: danger | |
SLACK_USERNAME: Github Actions | |
SLACK_ICON: https://github.com/github.png?size=48 | |
SLACK_TITLE: 'Veilarbaktivitet: deploy til prod feilet' | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_MESSAGE: 'Commit-message til feilende deploy: ${{ github.event.head_commit.message }}' |