Merge pull request #2955 from navikt/bugfix/react-router-dom #1691
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 and prod | |
on: | |
push: | |
branches: | |
- 'main' | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
build: | |
name: Build and push Docker container | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
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 test | |
run: yarn test | |
- name: Yarn build | |
run: yarn build | |
- name: Prune dev dependencies | |
run: yarn --prod --prefer-offline --frozen-lockfile | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }} | |
- name: Push docker image to GAR and sign image | |
uses: nais/docker-build-push@v0 | |
id: docker-build-push | |
with: | |
team: teamfamilie | |
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} | |
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} | |
- 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 }} | |
outputs: | |
image: ${{ steps.docker-build-push.outputs.image }} | |
deploy: | |
name: Deploy to NAIS | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Deploy til dev-gcp | |
uses: nais/deploy/actions/deploy@v2 | |
env: | |
CLUSTER: dev-gcp | |
RESOURCE: build_n_deploy/naiserator/dev.yaml | |
IMAGE: ${{ needs.build.outputs.image }} | |
- name: Deploy til prod-gcp | |
uses: nais/deploy/actions/deploy@v2 | |
env: | |
CLUSTER: prod-gcp | |
RESOURCE: build_n_deploy/naiserator/prod.yaml | |
IMAGE: ${{ needs.build.outputs.image }} | |
- 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 }} |