Merge pull request #1116 from navikt/upgrade_node_packages #656
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: Frackend | |
on: | |
push: | |
branches: | |
- 'main' | |
- 'dev/*' | |
paths: | |
- '.github/workflows/team-frackend.yml' | |
- 'apps/frackend/**' | |
- 'apps/frontend-2/**' | |
workflow_dispatch: | |
env: | |
IMAGE: ghcr.io/${{ github.repository }}/teamfrackend:${{ github.sha }} | |
jobs: | |
build: | |
name: Build and push docker | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'npm' | |
cache-dependency-path: apps/frackend/package-lock.json | |
- name: Install frontend | |
working-directory: apps/frontend-2 | |
run: npm install | |
- name: add version to frontend | |
env: | |
GITHUB_SHA: ${{ github.sha }} | |
working-directory: apps/frontend-2 | |
run: echo "VITE_APP_GIT_VERSION=${GITHUB_SHA}" >> .env | |
- name: Build frontend | |
working-directory: apps/frontend-2 | |
run: npm run build | |
- name: Copy frontend dist into public directory of frackend | |
working-directory: apps/frontend-2 | |
run: cp -r dist/ ../frackend/public | |
- name: Docker login | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Docker container | |
uses: docker/build-push-action@v3 | |
with: | |
context: apps/frackend | |
push: true | |
tags: ${{ env.IMAGE }} | |
deploy-dev: | |
name: Deploy dev-gcp | |
needs: build | |
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/dev') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: nais/deploy/actions/deploy@v1 | |
env: | |
APIKEY: ${{ secrets.NAIS_ORG_DEPLOY_APIKEY }} | |
CLUSTER: dev-gcp | |
RESOURCE: apps/frackend/nais/frackend-dev.yaml | |
deploy-prod: | |
name: Deploy prod-gcp | |
needs: deploy-dev | |
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_ORG_DEPLOY_APIKEY }} | |
CLUSTER: prod-gcp | |
RESOURCE: apps/frackend/nais/frackend-prod.yaml |