Skip to content

Merge pull request #2400 from navikt/skolepenger-2.0-form-komponent #1331

Merge pull request #2400 from navikt/skolepenger-2.0-form-komponent

Merge pull request #2400 from navikt/skolepenger-2.0-form-komponent #1331

name: Build, push, and deploy app to dev and prod
on:
push:
branches:
- 'master'
env:
IMAGE: ghcr.io/navikt/familie-ef-sak-frontend:${{ github.sha }}
IMAGE_LATEST: ghcr.io/navikt/familie-ef-sak-frontend:latest
jobs:
build:
name: Build and push Docker container
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
cache: yarn
registry-url: "https://npm.pkg.github.com"
- name: Yarn install
run: yarn --prefer-offline --frozen-lockfile
env:
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
- name: Yarn build
run: yarn build
- name: Build and publish Docker image
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
docker build . -t ${IMAGE} -t ${IMAGE_LATEST}
echo ${GITHUB_TOKEN} | docker login ghcr.io --username ${GITHUB_REPOSITORY} --password-stdin
docker push ${IMAGE}
docker push ${IMAGE_LATEST}
- name: Post build failures to Slack
if: failure()
run: |
curl -X POST --data "{m\"text\": \"Build av $GITHUB_REPOSITORY feilet - $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID\"}" $WEBHOOK_URL
env:
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
deploy:
name: Deploy to NAIS
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Deploy til dev-gcp
uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: build_n_deploy/naiserator/dev.yaml
- name: Deploy til prod-gcp
uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: prod-gcp
RESOURCE: build_n_deploy/naiserator/prod.yaml
- name: Post deploy failures to Slack
if: failure()
run: |
curl -X POST --data "{\"text\": \"Deploy av $GITHUB_REPOSITORY feilet - $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID\"}" $WEBHOOK_URL
env:
MESSAGE: "Deploy av feilet"
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}