Skip to content

Bump ip from 2.0.0 to 2.0.1 #2275

Bump ip from 2.0.0 to 2.0.1

Bump ip from 2.0.0 to 2.0.1 #2275

Workflow file for this run

name: Build and deploy
on:
workflow_dispatch:
push:
env:
IMAGE: ghcr.io/${{ github.repository }}/dp-faktasider-frontend:${{ github.sha }}
LATEST_IMAGE: ghcr.io/${{ github.repository }}/dp-faktasider-frontend:latest
jobs:
jest-test:
name: Jest tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 'lts/*'
cache: "npm"
registry-url: "https://npm.pkg.github.com"
- run: npm install --no-save --no-audit --prefer-offline --ignore-scripts
env:
TZ: Europe/Oslo
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
- run: npm rebuild && npm run prepare --if-present
env:
TZ: Europe/Oslo
- run: |
npm test
npm run typeCheck
install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache node_modules
uses: actions/cache@v3
id: node_modules
with:
path: ./node_modules
key: modules-${{ hashFiles('package-lock.json') }}
- uses: actions/setup-node@v3
if: steps.node_modules.outputs.cache-hit != 'true'
with:
node-version: 'lts/*'
cache: "npm"
registry-url: "https://npm.pkg.github.com"
- run: npm ci --ignore-scripts
if: steps.node_modules.outputs.cache-hit != 'true'
env:
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
build:
needs: [ install ]
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "lts/*"
- name: Cache node_modules
uses: actions/cache@v3
with:
path: ./node_modules
key: modules-${{ hashFiles('package-lock.json') }}
- name: Cache .next/cache
uses: actions/cache@v3
with:
path: ./.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
- run: npm run build
# Bygg docker image
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v3
with:
context: .
push: true
pull: true
tags: ${{ env.IMAGE }},${{ env.LATEST_IMAGE }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Cache static files
uses: actions/cache@v3
with:
path: ./.next/static
key: ${{ github.sha }}
deploy-dev-gcp:
name: Deploy to dev gcp
needs: [build, jest-test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: nais/nais.yaml
VARS: nais/dev-gcp/vars.yaml
PRINT_PAYLOAD: true
- name: Lag deployment i Sentry
uses: getsentry/action-release@v1
continue-on-error: true
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_URL: https://sentry.gc.nav.no
SENTRY_ORG: nav
SENTRY_PROJECT: dp-faktasider-frontend
with:
environment: development
version: ${{ github.sha }}
set_commits: skip
deploy-prod-gcp:
name: Deploy to prod gcp
needs: [deploy-dev-gcp]
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: prod-gcp
RESOURCE: nais/nais.yaml
VARS: nais/prod-gcp/vars.yaml
PRINT_PAYLOAD: true
- name: Lag deployment i Sentry
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_URL: https://sentry.gc.nav.no
SENTRY_ORG: nav
SENTRY_PROJECT: dp-faktasider-frontend
with:
environment: production
version: ${{ github.sha }}
set_commits: skip