Lar sonar kjøre på dependabot PR-er #224
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 application | |
on: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: deploy_main | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
id-token: write | |
env: | |
IMAGE_TAG: ${{ github.sha }} | |
IMAGE: ghcr.io/${{ github.repository }}/aktivitet-arena-acl | |
PRINT_PAYLOAD: true | |
jobs: | |
test-build-push: | |
name: Test, build and push | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
id-token: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 21 | |
cache: 'maven' | |
- name: Build maven artifacts | |
run: mvn -B package | |
- 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: 'aktivitet-arena-acl: bygg 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 | |
outputs: | |
image: ${{ steps.docker-build-push.outputs.image }} | |
telemetry: ${{ steps.docker-build-push.outputs.telemetry }} | |
deploy-dev: | |
name: Deploy to dev | |
needs: [test-build-push] | |
uses: ./.github/workflows/naisdeploy.yaml | |
with: | |
environment: dev | |
VAR: image=${{ needs.test-build-push.outputs.image }} | |
TELEMETRY: ${{ needs.test-build-push.outputs.telemetry }} | |
secrets: | |
nais-deploy-secret: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
deploy-prod: | |
name: Deploy to prod | |
needs: [test-build-push, deploy-dev] | |
uses: ./.github/workflows/naisdeploy.yaml | |
with: | |
environment: prod | |
VAR: image=${{ needs.test-build-push.outputs.image }} | |
TELEMETRY: ${{ needs.test-build-push.outputs.telemetry }} | |
secrets: | |
nais-deploy-secret: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} |