legger til codeowners #498
Workflow file for this run
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 deploy | |
on: [push] | |
env: | |
IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }} | |
LATEST_IMAGE: ghcr.io/${{ github.repository }}:latest | |
jobs: | |
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: "18.x" | |
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 }} | |
test: | |
needs: [install] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "18.x" | |
- name: Cache node_modules | |
uses: actions/cache@v3 | |
with: | |
path: ./node_modules | |
key: modules-${{ hashFiles('package-lock.json') }} | |
- run: npm run test | |
build: | |
needs: [install] | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "18.x" | |
- name: Cache node_modules | |
uses: actions/cache@v3 | |
with: | |
path: ./node_modules | |
key: modules-${{ hashFiles('package-lock.json') }} | |
- run: npm run build | |
# Bygg docker image | |
- uses: docker/setup-buildx-action@v2 | |
- uses: docker/login-action@v2 | |
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: | | |
./build | |
./public | |
key: ${{ github.sha }} | |
upload-cdn: | |
needs: [build, test] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: "read" | |
id-token: "write" | |
steps: | |
- uses: actions/cache@v3 | |
id: restore-build | |
with: | |
path: | | |
./build | |
./public | |
key: ${{ github.sha }} | |
fail-on-cache-miss: true | |
- name: Upload static files | |
uses: navikt/frontend/actions/cdn-upload/v1@main | |
with: | |
cdn-team-name: teamdagpenger | |
source: ./public | |
destination: "/dp-rapportering-frontend/" | |
deploy-dev: | |
needs: [build, test, upload-cdn] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: nais/deploy/actions/deploy@v1 | |
env: | |
VAR: commit=${{ github.sha }} | |
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
CLUSTER: dev-gcp | |
RESOURCE: .nais/nais.yaml | |
VARS: .nais/vars-dev.yaml | |
PRINT_PAYLOAD: true |