Version Packages (#3366) #997
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: Deploy aksel.nav.no | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "aksel.nav.no/**" | |
env: | |
IMAGE: ghcr.io/navikt/aksel | |
jobs: | |
sync_data_with_sanity: | |
name: Update component data | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
cache: yarn | |
- name: set-env for yarn install to @navikt scope | |
shell: bash | |
run: echo "NPM_AUTH_TOKEN=${{ secrets.READER_TOKEN }}" >> $GITHUB_ENV | |
- name: Install dependencies | |
run: yarn | |
- name: Run docgen | |
run: | | |
yarn boot | |
yarn docgen | |
- name: Update sanity sync | |
env: | |
SANITY_WRITE: ${{ secrets.SANITY_WRITE }} | |
run: yarn workspace aksel.nav.no sanity:update | |
build_and_deploy: | |
name: Build and deploy to prod-gcp | |
runs-on: ubuntu-latest | |
permissions: | |
packages: "write" | |
contents: "read" | |
id-token: "write" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
cache: yarn | |
- name: set-env for yarn install to @navikt scope | |
shell: bash | |
run: echo "NPM_AUTH_TOKEN=${{ secrets.READER_TOKEN }}" >> $GITHUB_ENV | |
- name: add tokens to .env | |
run: | | |
echo "USE_CDN_ASSETS=true" >> aksel.nav.no/website/.env | |
- name: Install dependencies | |
run: yarn | |
- name: Build packages | |
run: yarn boot | |
- name: Tests | |
run: yarn workspace website test | |
- name: Build application | |
env: | |
SANITY_READ: ${{ secrets.SANITY_READ }} | |
SANITY_READ_NO_DRAFTS: ${{ secrets.SANITY_READ_NO_DRAFTS }} | |
run: yarn workspace aksel.nav.no build:next | |
- name: Upload static files to NAV CDN | |
uses: nais/deploy/actions/cdn-upload/v2@master | |
with: | |
team: designsystem | |
source: ./aksel.nav.no/website/.next/static | |
destination: "/website/_next" | |
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} | |
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} | |
- name: Get complete tag | |
run: echo "TAG=PROD-$( date +%s )" >> $GITHUB_ENV | |
- uses: nais/docker-build-push@v0 | |
id: docker-push | |
with: | |
team: designsystem | |
push_image: true | |
dockerfile: aksel.nav.no/Dockerfile | |
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} | |
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} | |
- name: Deploy to prod-gcp | |
uses: nais/deploy/actions/deploy@master | |
env: | |
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
RESOURCE: aksel.nav.no/nais-prod.yaml | |
CLUSTER: prod-gcp | |
IMAGE: ${{ steps.docker-push.outputs.image }} |