This repository has been archived by the owner on Jun 7, 2024. It is now read-only.
Merge pull request #878 from navikt/dev/migrering-designsystemet-v5 #1934
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: Build, push, and deploy | |
on: | |
push: | |
branches: | |
- main | |
- dev/* | |
jobs: | |
build-cdn-docker: | |
name: Build, CDN & Docker | |
runs-on: ubuntu-latest | |
permissions: | |
contents: 'read' | |
packages: 'write' | |
id-token: 'write' | |
steps: | |
- uses: actions/checkout@v3 | |
name: Checkout | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18.17.0' | |
cache: 'npm' | |
- name: 'Install dependencies' | |
run: 'npm ci' | |
- name: 'Build application' | |
run: 'REACT_APP_MICRO="true" REACT_APP_VERSION_HASH=${{ github.sha }} REACT_APP_BUILD_TIMESTAMP=$(date +"%Y-%m-%dT%H:%M:%S") NODE_ENV=production npm run build:cdn' | |
- name: cdn-upload | |
uses: navikt/frontend/actions/cdn-upload/v1@main | |
with: | |
cdn-team-name: paw | |
source: ./dist/js | |
destination: '/aia/' | |
- name: docker-build-push | |
uses: nais/docker-build-push@v0 | |
id: docker-build-push | |
with: | |
team: paw | |
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} | |
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} | |
outputs: | |
image: ${{ steps.docker-build-push.outputs.image }} | |
deploy-dev: | |
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/dev') | |
name: Deploy til dev | |
needs: build-cdn-docker | |
runs-on: ubuntu-latest | |
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: .nais/dev.yaml | |
VAR: image=${{ needs.build-cdn-docker.outputs.image }} | |
deploy-prod: | |
if: github.ref == 'refs/heads/main' | |
name: Deploy til prod | |
needs: [build-cdn-docker, deploy-dev] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Deploy | |
uses: nais/deploy/actions/deploy@v1 | |
env: | |
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
DRY_RUN: false | |
CLUSTER: prod-gcp | |
RESOURCE: .nais/nais.yaml | |
VAR: image=${{ needs.build-cdn-docker.outputs.image }} | |
VARS: .nais/vars-prod.yaml |