Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

Deploy til dev

Deploy til dev #222

Workflow file for this run

name: Build and deploy
on: [ push ]
env:
IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}
concurrency:
group: build-deploy-on-${{ github.ref }}
cancel-in-progress: true
jobs:
compile-test-and-build:
name: Build and run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: https://npm.pkg.github.com/
cache: 'yarn'
cache-dependency-path: |
yarn.lock
server/yarn.lock
- name: Install dependencies for server
run: cd server && yarn install --frozen-lockfile --prefer-offline
env:
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
- name: Install dependencies
run: yarn install --frozen-lockfile --prefer-offline
env:
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
- name: Run tests
run: yarn test
- name: Build application
run: yarn build
env:
CI: false
- name: Login to GitHub Docker Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push the Docker image
run: |
docker build . -t ${IMAGE}
docker push ${IMAGE}
deploy-to-dev-gcp:
name: Deploy to dev-gcp
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/session-metric-v2'
needs: compile-test-and-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
VAR: version=${{ env.IMAGE }}
RESOURCE: nais/dev-gcp.yaml
PRINT_PAYLOAD: true
deploy-to-dev-gcp-ekstern:
name: Deploy to dev-gcp-ekstern
if: github.ref == 'refs/heads/master'
needs: compile-test-and-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
VAR: version=${{ env.IMAGE }}
RESOURCE: nais/dev-gcp-ekstern.yaml
PRINT_PAYLOAD: true
deploy-to-prod-gcp:
name: Deploy to prod-gcp
if: github.ref == 'refs/heads/master'
needs: compile-test-and-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: prod-gcp
VAR: version=${{ env.IMAGE }}
RESOURCE: nais/prod-gcp.yaml
PRINT_PAYLOAD: true