Skip to content

wip

wip #1761

Workflow file for this run

name: Bygg og deploy
on: [push, workflow_dispatch]
permissions:
contents: read
id-token: write
jobs:
bygg-og-push-docker-image:
name: Bygg og push
runs-on: ubuntu-latest
outputs:
image: ${{ steps.docker-build-push.outputs.image }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
cache-dependency-path: |
package-lock.json
server/package-lock.json
- name: Installer avhengigheter
run: npm ci
- name: Bygg applikasjon
run: npm run build
- name: Test applikasjon
run: npm run test
- name: Installer avhengigheter for server
run: cd server && npm ci
- name: Bygg server
run: cd server && npm run build
- name: Test server
run: cd server && npm run test
- name: Push docker image to GAR
uses: nais/docker-build-push@v0
if: github.actor != 'dependabot[bot]'
id: docker-build-push
with:
team: toi
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
deploy-til-dev:
name: Deploy til dev-gcp
needs: bygg-og-push-docker-image
if: github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/decorator-css-ref'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: dev-gcp
RESOURCE: deploy/nais.yaml
VARS: deploy/dev-gcp.json
VAR: image=${{ needs.bygg-og-push-docker-image.outputs.image }}
deploy-to-prod:
name: Deploy til prod-gcp
needs: [bygg-og-push-docker-image, deploy-til-dev]
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: prod-gcp
RESOURCE: deploy/nais.yaml
VARS: deploy/prod-gcp.json
VAR: image=${{ needs.bygg-og-push-docker-image.outputs.image }}