This repository has been archived by the owner on Jun 7, 2024. It is now read-only.
c setter cdn upload til v2 et sted det var glemt #2098
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@v4 | |
name: Checkout | |
- uses: actions/setup-node@v4 | |
with: | |
cache: 'npm' | |
node-version: '20.x' | |
registry-url: 'https://npm.pkg.github.com' | |
scope: '@navikt' | |
- name: 'Install dependencies' | |
run: 'npm ci' | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }} | |
- name: 'Build cdn' | |
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-js | |
uses: navikt/frontend/actions/cdn-upload/v2@master | |
with: | |
cdn-team-name: paw | |
source: ./dist/js | |
destination: '/aia/' | |
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} | |
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} | |
- name: 'Build demo' | |
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:demo' | |
- name: cdn-upload-assets | |
uses: nais/deploy/actions/cdn-upload/v2@master | |
with: | |
team: paw | |
source: ./dist/assets | |
destination: '/aia/' | |
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} | |
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} | |
- 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 | |
permissions: | |
contents: "read" | |
id-token: "write" | |
needs: build-cdn-docker | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Deploy | |
uses: nais/deploy/actions/deploy@v2 | |
env: | |
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 | |
permissions: | |
contents: "read" | |
id-token: "write" | |
needs: [build-cdn-docker, deploy-dev] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Deploy | |
uses: nais/deploy/actions/deploy@v2 | |
env: | |
DRY_RUN: false | |
CLUSTER: prod-gcp | |
RESOURCE: .nais/nais.yaml | |
VAR: image=${{ needs.build-cdn-docker.outputs.image }} | |
VARS: .nais/vars-prod.yaml |