Build, push, and deploy app to dev #1544
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, push, and deploy app to dev | |
on: | |
workflow_dispatch: | |
env: | |
IMAGE: ghcr.io/navikt/familie-ef-soknad:${{ github.sha }} | |
jobs: | |
build: | |
name: Build and push Docker container | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: npm | |
registry-url: "https://npm.pkg.github.com" | |
- name: Npm install and build | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }} | |
run: | | |
npm ci | |
npm run test-ci | |
npm run build | |
- name: Npm build server | |
working-directory: ./server | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }} | |
run: | | |
npm ci | |
npm run build | |
- name: Build and publish Docker image | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.READER_TOKEN }} | |
run: | | |
docker build . -t ${IMAGE} | |
echo ${GITHUB_TOKEN} | docker login ghcr.io --username ${GITHUB_REPOSITORY} --password-stdin | |
docker push ${IMAGE} | |
deploy: | |
name: Deploy to NAIS | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: deploy to gcp-dev | |
uses: nais/deploy/actions/deploy@v1 | |
env: | |
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
CLUSTER: dev-gcp | |
RESOURCE: nais-dev.yaml |