Endre tiltakskode for Jobbklubb fra JOBBKLUBB til JOBBK #103
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: | |
packages: write | |
contents: write | |
env: | |
IMAGE_TAG: ${{ github.sha }} | |
IMAGE: ghcr.io/${{ github.repository }}/aktivitet-arena-acl | |
PRINT_PAYLOAD: true | |
jobs: | |
test-build-and-push: | |
name: Test, build and push | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
cache: 'maven' | |
- name: Build maven artifacts | |
run: mvn -B package | |
- uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: true | |
tags: ${{ env.IMAGE }}:${{ env.IMAGE_TAG }} | |
deploy-dev: | |
name: Deploy to dev | |
needs: test-build-and-push | |
uses: ./.github/workflows/naisdeploy.yaml | |
with: | |
environment: dev | |
secrets: | |
nais-deploy-secret: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
deploy-prod: | |
name: Deploy to prod | |
needs: test-build-and-push | |
uses: ./.github/workflows/naisdeploy.yaml | |
with: | |
environment: prod | |
secrets: | |
nais-deploy-secret: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} |