Update url we change to when location changes #5332
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 and test monorepo, and deploy bygger | |
on: push | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
concurrency: deploy-${{ github.ref }} | |
jobs: | |
build-and-test: | |
name: 'Build and test packages' | |
runs-on: ubuntu-latest-8-cores | |
permissions: | |
contents: 'read' | |
packages: 'read' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.9.0' | |
cache: 'yarn' | |
cache-dependency-path: '**/yarn.lock' | |
registry-url: https://npm.pkg.github.com/ | |
scope: '@navikt' | |
- name: set timezone | |
uses: szenius/set-timezone@v2.0 | |
with: | |
timezoneLinux: 'Europe/Oslo' | |
- name: 'Install dependencies' | |
run: yarn --frozen-lockfile | |
- name: 'No unstaged changes allowed (changes in yarn.lock?)' | |
run: git diff --quiet | |
- name: 'Check types' | |
run: yarn check-types | |
- name: 'Build' | |
run: yarn build | |
- name: 'Test bygger' | |
run: yarn test:bygger | |
- name: 'Test fyllut' | |
run: yarn test:fyllut | |
- name: 'Test shared-components' | |
run: yarn test:shared-components | |
- name: 'Test shared-domain' | |
run: yarn test:shared-domain | |
package-and-push-bygger: | |
if: github.ref == 'refs/heads/master' | |
name: 'Package bygger' | |
runs-on: ubuntu-latest-8-cores | |
permissions: | |
contents: 'read' | |
id-token: 'write' | |
packages: 'read' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.9.0' | |
cache: 'yarn' | |
cache-dependency-path: '**/yarn.lock' | |
registry-url: https://npm.pkg.github.com/ | |
scope: '@navikt' | |
- name: 'Build application: Bygger' | |
env: | |
VITE_GIT_VERSION: ${{ github.sha }} | |
run: yarn --frozen-lockfile && yarn build | |
- name: Build and push Docker image for bygger | |
uses: nais/docker-build-push@v0 | |
id: docker-build-push-bygger | |
with: | |
team: skjemadigitalisering | |
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} | |
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} | |
image_suffix: ${{ github.ref == 'refs/heads/master' && 'bygger' || 'bygger-dev' }} | |
build_args: | | |
git_sha=${{ github.sha }} | |
dockerfile: ./docker/Dockerfile.bygger | |
docker_context: ./packages | |
outputs: | |
image: ${{ steps.docker-build-push-bygger.outputs.image }} | |
package-and-push-fyllut-base: | |
if: github.ref == 'refs/heads/master' | |
name: 'Package fyllut' | |
runs-on: ubuntu-latest-8-cores | |
permissions: | |
contents: 'read' | |
id-token: 'write' | |
packages: 'read' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.9.0' | |
cache: 'yarn' | |
cache-dependency-path: '**/yarn.lock' | |
registry-url: https://npm.pkg.github.com/ | |
scope: '@navikt' | |
- name: 'Build application: Fyllut' | |
env: | |
VITE_GIT_VERSION: ${{ github.sha }} | |
run: yarn --frozen-lockfile && yarn build | |
- name: 'Build and push Docker image: fyllut-base-dev' | |
uses: nais/docker-build-push@v0 | |
id: docker-build-push-dev | |
with: | |
team: skjemadigitalisering | |
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} | |
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} | |
image_suffix: fyllut-base-dev # base image for dev | |
build_args: | | |
git_sha=${{ github.sha }} | |
dockerfile: ./docker/Dockerfile.fyllut-base | |
docker_context: ./packages | |
pull: true | |
tag: ${{ github.sha }} | |
- name: 'Build and push Docker image: fyllut-base' | |
if: github.ref == 'refs/heads/master' | |
uses: nais/docker-build-push@v0 | |
id: docker-build-push | |
with: | |
team: skjemadigitalisering | |
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} | |
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} | |
image_suffix: fyllut-base # base image for prod | |
build_args: | | |
git_sha=${{ github.sha }} | |
dockerfile: ./docker/Dockerfile.fyllut-base | |
docker_context: ./packages | |
pull: true | |
tag: ${{ github.sha }} | |
deploy-bygger-to-prod: | |
name: 'Deploy bygger to prod' | |
if: github.ref == 'refs/heads/master' | |
needs: [build-and-test, package-and-push-bygger, package-and-push-fyllut-base] | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: 'write' | |
steps: | |
- uses: 'actions/checkout@v4' | |
- name: 'Deploy to PROD' | |
uses: 'nais/deploy/actions/deploy@v2' | |
env: | |
CLUSTER: 'prod-gcp' | |
RESOURCE: './.nais/bygger/nais.yaml' | |
VARS: './.nais/bygger/prod.yaml' | |
VAR: 'image=${{ needs.package-and-push-bygger.outputs.image }}' | |
trigger-deploy-fyllut-to-dev: | |
name: 'Trigger deploy fyllut to dev' | |
needs: [build-and-test, package-and-push-bygger, package-and-push-fyllut-base] | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Generate app installation access token' | |
uses: navikt/github-app-token-generator@v1 | |
id: generate-token | |
with: | |
private-key: ${{ secrets.PUBLISHING_APP_PRIVATE_KEY }} | |
app-id: ${{ secrets.PUBLISHING_APP_ID }} | |
repo: navikt/skjemautfylling-formio | |
- name: 'Trigger deploy fyllut to dev' | |
uses: benc-uk/workflow-dispatch@v1 | |
with: | |
workflow: 'Trigger dev deploy' | |
repo: navikt/skjemautfylling-formio | |
ref: 'dev-deploy' | |
token: ${{ steps.generate-token.outputs.token }} | |
inputs: '{ "monorepoGitHash": "${{ github.sha }}" }' |