CI/CD (mr-arena-adapter) #1748
Workflow file for this run
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: CI/CD (mr-arena-adapter) | |
on: | |
merge_group: | |
pull_request: | |
paths: | |
- .github/workflows/mr-arena-adapter.yaml | |
- build.gradle.kts | |
- settings.gradle.kts | |
- gradle.properties | |
- gradle/libs.versions.toml | |
- common/** | |
- mulighetsrommet-arena-adapter/** | |
push: | |
branches: | |
- main | |
paths: | |
- .github/workflows/mr-arena-adapter.yaml | |
- build.gradle.kts | |
- settings.gradle.kts | |
- gradle.properties | |
- gradle/libs.versions.toml | |
- common/** | |
- mulighetsrommet-arena-adapter/** | |
workflow_dispatch: | |
inputs: | |
environment: | |
type: choice | |
description: Environment | |
required: true | |
default: dev | |
options: | |
- dev | |
- dev_and_prod | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
CI: true | |
TZ: Europe/Amsterdam | |
jobs: | |
ci: | |
name: CI | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # Needed for `mikepenz/gradle-dependency-submission` | |
id-token: write # Needed for `nais/docker-build-push` | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup backend | |
uses: ./.github/actions/setup-backend | |
- name: Build with Gradle | |
run: ./gradlew :mulighetsrommet-arena-adapter:build | |
- name: Submit Gradle dependencies | |
uses: mikepenz/gradle-dependency-submission@v1 | |
if: github.ref_name == 'main' | |
with: | |
gradle-build-module: :mulighetsrommet-arena-adapter | |
sub-module-mode: INDIVIDUAL | |
- name: Build and push Docker image | |
uses: nais/docker-build-push@v0 | |
id: docker-build-push | |
if: github.event_name == 'push' && github.ref_name == 'main' || github.event_name == 'workflow_dispatch' | |
with: | |
team: team-mulighetsrommet | |
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} | |
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} | |
dockerfile: ./mulighetsrommet-arena-adapter/Dockerfile | |
docker_context: mulighetsrommet-arena-adapter | |
image_suffix: mulighetsrommet-arena-adapter | |
outputs: | |
image: ${{ steps.docker-build-push.outputs.image }} | |
deploy-dev: | |
name: Deploy (dev) | |
runs-on: ubuntu-latest | |
needs: [ci] | |
if: github.event_name == 'push' && github.ref_name == 'main' || github.event_name == 'workflow_dispatch' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Deploy | |
uses: nais/deploy/actions/deploy@v1 | |
env: | |
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
CLUSTER: dev-gcp | |
RESOURCE: mulighetsrommet-arena-adapter/.nais/nais-dev.yaml | |
VAR: image=${{ needs.ci.outputs.image }} | |
deploy-prod: | |
name: Deploy (prod) | |
runs-on: ubuntu-latest | |
needs: [ci, deploy-dev] | |
if: github.event_name == 'push' && github.ref_name == 'main' || github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'dev_and_prod' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Deploy | |
uses: nais/deploy/actions/deploy@v1 | |
env: | |
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
CLUSTER: prod-gcp | |
RESOURCE: mulighetsrommet-arena-adapter/.nais/nais-prod.yaml | |
VAR: image=${{ needs.ci.outputs.image }} |