Version Packages (#2604) #668
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/setup-node@v3 | |
with: | |
node-version: "20" | |
- uses: actions/checkout@v3 | |
- name: add tokens to .env | |
run: | | |
echo "SANITY_WRITE_KEY=${{ secrets.SANITY_FEEDBACK_WRITE_KEY }}" >> aksel.nav.no/website/.env | |
- name: Restore cache | |
uses: actions/cache@v3 | |
with: | |
path: "**/node_modules" | |
key: ${{ runner.os }}-prod-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-prod- | |
- name: Install dependencies | |
run: yarn | |
- name: Run docgen | |
run: | | |
yarn boot | |
yarn docgen | |
- name: Update sanity sync | |
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/setup-node@v3 | |
with: | |
node-version: "20" | |
- uses: actions/checkout@v3 | |
- name: add tokens to .env | |
run: | | |
echo "SANITY_WRITE_KEY=${{ secrets.SANITY_FEEDBACK_WRITE_KEY }}" >> aksel.nav.no/website/.env | |
echo "SANITY_PREVIEW_TOKEN=${{ secrets.SANITY_PREVIEW_TOKEN }}" >> aksel.nav.no/website/.env | |
echo "SANITY_PRIVATE_NO_DRAFTS=${{ secrets.SANITY_PRIVATE_NO_DRAFTS }}" >> aksel.nav.no/website/.env | |
echo "USE_CDN_ASSETS=true" >> aksel.nav.no/website/.env | |
- name: Restore cache | |
uses: actions/cache@v3 | |
with: | |
path: "**/node_modules" | |
key: ${{ runner.os }}-prod-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-prod- | |
- name: Install dependencies | |
run: yarn | |
- name: Build packages | |
run: yarn boot | |
- name: Tests | |
run: yarn workspace aksel.nav.no test | |
- name: Build application | |
run: yarn workspace aksel.nav.no build:next | |
- name: Upload static files to NAV CDN | |
uses: navikt/frontend/actions/cdn-upload/v1@main | |
with: | |
cdn-team-name: aksel | |
source: ./aksel.nav.no/website/.next/static | |
destination: "/website/_next" | |
- 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 }} |