Skip to content

Remove blocking any branch to be dispatched to dev #2

Remove blocking any branch to be dispatched to dev

Remove blocking any branch to be dispatched to dev #2

name: 'deploy: frackend'
on:
push:
branches:
- 'main'
paths:
- '.github/workflows/deploy-frackend.yaml'
- 'apps/frackend/**'
- 'apps/frontend/**'
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
run: npm install
- name: add version to frontend
env:
GITHUB_SHA: ${{ github.sha }}
working-directory: apps/frontend
run: echo "VITE_APP_GIT_VERSION=${GITHUB_SHA}" >> .env
- name: Build frontend
working-directory: apps/frontend
run: npm run build
- name: Copy frontend dist into public directory of frackend
working-directory: apps/frontend
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
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