Skip to content

CI/CD (arrangor-flate) #797

CI/CD (arrangor-flate)

CI/CD (arrangor-flate) #797

name: CI/CD (arrangor-flate)
on:
push:
paths:
- .github/workflows/cicd-arrangor-flate.yaml
- .github/workflows/actions/*
- package.json
- pnpm-lock.yaml
- turbo.json
- frontend/api-client/**
- mulighetsrommet-api/src/main/resources/web/openapi.yaml
- frontend/arrangor-flate/**
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
permissions:
contents: read
id-token: write
jobs:
playwright-version:
name: Get playwright version
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: frontend/arrangor-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 playwright --filter=@mr/arrangor-flate
deploy-til-dev:
name: Deploy til dev-gcp
needs: ci
if: github.event_name == 'push' && github.ref_name == 'main' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Bygg applikasjon
run: npx turbo run pack --filter=@mr/arrangor-flate
- name: Push docker image to GAR
uses: nais/docker-build-push@v0
id: docker-build-push
with:
team: team-mulighetsrommet
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
docker_context: ./frontend/arrangor-flate
image_suffix: arrangor-flate
- uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: dev-gcp
RESOURCE: frontend/arrangor-flate/.nais/nais-dev.yaml
VAR: image=${{ steps.docker-build-push.outputs.image }}
# TODO Skru på deploy til prod når alt er klart for arrangørflate
# deploy-til-prod:
# name: Deploy til prod-gcp
# needs: [ci, deploy-til-dev]
# if: github.event_name == 'push' && github.ref_name == 'main' || github.event_name == 'workflow_dispatch'
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: nais/deploy/actions/deploy@v2
# env:
# CLUSTER: prod-gcp
# RESOURCE: frontend/arrangor-flate/.nais/nais-prod.yaml
# VAR: image=${{ needs.ci.outputs.image }}