Skip to content

Fjern kurstittel

Fjern kurstittel #6679

name: CI/CD (mr-veileder-flate)
on:
push:
paths:
- .github/workflows/mr-veileder-flate.yaml
- package.json
- pnpm-lock.yaml
- turbo.json
- frontend/mulighetsrommet-veileder-flate/**
- frontend/api-client/**
- mulighetsrommet-api/src/main/resources/web/openapi.yaml
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:
playwright-version:
name: Get playwright version
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: frontend/mulighetsrommet-veileder-flate
outputs:
version: ${{ steps.get-version.outputs.version }}
steps:
- uses: actions/checkout@v4
- id: get-version
run: echo "version=$(cat package.json | jq -r '.devDependencies.playwright' | sed -e 's/^[\^\~]//')" >> "$GITHUB_OUTPUT"
ci:
name: CI
runs-on: ubuntu-latest
needs: playwright-version
container:
image: mcr.microsoft.com/playwright:v${{ needs.playwright-version.outputs.version }}-jammy
steps:
- uses: actions/checkout@v4
- name: Setup frontend
uses: ./.github/actions/setup-frontend
env:
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
- name: Test
run: npx turbo run lint typecheck test playwright --filter=mulighetsrommet-veileder-flate
deploy-modia-dev:
name: Deploy (modia-dev)
runs-on: ubuntu-latest
needs: [ci]
permissions:
id-token: "write" # Used to authenticate with Google Cloud (through cdn-upload)
if: github.event_name == 'push' && github.ref_name == 'main' || github.event_name == 'workflow_dispatch'
steps:
- uses: actions/checkout@v4
- name: Setup frontend
uses: ./.github/actions/setup-frontend
env:
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
- name: Build
run: npx turbo run build:modia --filter=mulighetsrommet-veileder-flate -- --base=https://cdn.nav.no/team-mulighetsrommet/dev/arbeidsmarkedstiltak-modia/dist
env:
VITE_FARO_URL: https://telemetry.ekstern.dev.nav.no/collect
VITE_PORTEN_URL: https://jira.adeo.no/plugins/servlet/desk/portal/541/create/1401
- name: Upload to Nav CDN
uses: nais/deploy/actions/cdn-upload/v2@master
with:
team: team-mulighetsrommet
source: frontend/mulighetsrommet-veileder-flate/dist
destination: dev/arbeidsmarkedstiltak-modia
no_cache_paths: dev/arbeidsmarkedstiltak-modia/dist/asset-manifest.json
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
deploy-modia-prod:
name: Deploy (modia-prod)
runs-on: ubuntu-latest
needs: [deploy-modia-dev]
permissions:
id-token: "write" # Used to authenticate with Google Cloud (through cdn-upload)
if: github.event_name == 'push' && github.ref_name == 'main' || github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'dev_and_prod'
steps:
- uses: actions/checkout@v4
- name: Setup frontend
uses: ./.github/actions/setup-frontend
env:
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
- name: Build
run: npx turbo run build:modia --filter=mulighetsrommet-veileder-flate -- --base=https://cdn.nav.no/team-mulighetsrommet/prod/arbeidsmarkedstiltak-modia/dist
env:
VITE_FARO_URL: https://telemetry.nav.no/collect
VITE_PORTEN_URL: https://jira.adeo.no/plugins/servlet/desk/portal/541/create/1401
- name: Upload to Nav CDN
uses: nais/deploy/actions/cdn-upload/v2@master
with:
team: team-mulighetsrommet
source: frontend/mulighetsrommet-veileder-flate/dist
destination: prod/arbeidsmarkedstiltak-modia
no_cache_paths: prod/arbeidsmarkedstiltak-modia/dist/asset-manifest.json
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
deploy-nav-dev:
name: Deploy (nav-dev)
runs-on: ubuntu-latest
needs: [ci]
permissions:
id-token: "write" # Used to authenticate with Google Cloud
if: github.event_name == 'push' && github.ref_name == 'main' || github.event_name == 'workflow_dispatch'
steps:
- uses: actions/checkout@v4
- name: Setup frontend
uses: ./.github/actions/setup-frontend
env:
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
- name: Build
run: npx turbo run build:nav --filter=mulighetsrommet-veileder-flate
env:
VITE_FARO_URL: https://telemetry.ekstern.dev.nav.no/collect
VITE_AMPLITUDE_API_KEY: 669d3e2dcff1396f26ae5df125ed505e
VITE_PORTEN_URL: https://jira.adeo.no/plugins/servlet/desk/portal/541/create/5406
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
workload_identity_provider: projects/932652929200/locations/global/workloadIdentityPools/github/providers/github-action
service_account: [email protected]
- name: Set up gcloud
uses: google-github-actions/setup-gcloud@v2
- name: Upload files to GCS
run: gsutil -m rsync -r frontend/mulighetsrommet-veileder-flate/dist gs://arbeidsmarkedstiltak-nav-dev
deploy-nav-prod:
name: Deploy (nav-prod)
runs-on: ubuntu-latest
needs: [deploy-nav-dev]
permissions:
id-token: "write" # Used to authenticate with Google Cloud
if: github.event_name == 'push' && github.ref_name == 'main' || github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'dev_and_prod'
steps:
- uses: actions/checkout@v4
- name: Setup frontend
uses: ./.github/actions/setup-frontend
env:
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
- name: Build
run: npx turbo run build:nav --filter=mulighetsrommet-veileder-flate
env:
VITE_FARO_URL: https://telemetry.nav.no/collect
VITE_AMPLITUDE_API_KEY: 927491550bf305e5263e65255d8fd900
VITE_PORTEN_URL: https://jira.adeo.no/plugins/servlet/desk/portal/541/create/5406
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
workload_identity_provider: projects/380520190028/locations/global/workloadIdentityPools/github/providers/github-action
service_account: prod-deploy@team-mulighetsrommet-prod-5492.iam.gserviceaccount.com
- name: Set up gcloud
uses: google-github-actions/setup-gcloud@v2
- name: Upload files to GCS
run: gsutil -m rsync -r frontend/mulighetsrommet-veileder-flate/dist gs://arbeidsmarkedstiltak-nav-prod