Skip to content

deploy: frackend

deploy: frackend #56

name: 'deploy: frackend'
on:
push:
branches:
- 'main'
paths:
- '.github/workflows/deploy-frackend.yaml'
- 'apps/frackend/**'
- 'apps/frontend/**'
workflow_dispatch:
env:
IMAGE: ghcr.io/${{ github.repository }}/teamfrackend:${{ github.sha }}
jobs:
build-app-docker:
name: Build and push docker
permissions:
contents: "read"
id-token: "write"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://npm.pkg.github.com/
scope: '@navikt'
- name: Install frontend
working-directory: apps/frontend
run: npm install
- name: Build frontend
working-directory: apps/frontend
run: npm run build
- name: Copy frontend dist into public directory of frackend
working-directory: apps/frontend
run: cp -r dist/ ../frackend/public
- name: Install frackend dependencies
working-directory: apps/frackend
run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
- name: Build frackend
working-directory: apps/frackend
run: npm run build
- name: Build and push Docker image
uses: nais/docker-build-push@v0
id: docker-push
with:
team: nom
image_suffix: nom-ui2
docker_context: apps/frackend
dockerfile: apps/frackend/Dockerfile
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
outputs:
image: ${{ steps.docker-push.outputs.image }}
deploy-dev:
name: Deploy dev-gcp
needs: build-app-docker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_ORG_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: apps/frackend/nais/frackend-dev.yaml
VAR: image=${{needs.build-app-docker.outputs.image}}
deploy-prod:
name: Deploy prod-gcp
needs: build-app-docker
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_ORG_DEPLOY_APIKEY }}
CLUSTER: prod-gcp
RESOURCE: apps/frackend/nais/frackend-prod.yaml
VAR: image=${{needs.build-app-docker.outputs.image}}