Build and deploy app || Oppgraderte pakker, forhåpentligvis bare de safe. #1250
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, test and deploy | |
run-name: Build and deploy app || ${{ github.event.head_commit.message }} | |
on: | |
push: | |
branches: | |
- main | |
- packageupdate | |
paths-ignore: | |
- "**.md" | |
- "**/**.md" | |
permissions: | |
contents: read | |
id-token: write | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
docker-build-push: | |
name: Build, test and push docker image | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
registry-url: https://npm.pkg.github.com | |
cache: yarn | |
- name: Install dependencies | |
run: yarn install --immutable | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }} | |
- name: Lint | |
run: yarn lint | |
- name: Run tests | |
run: yarn test | |
- name: Build | |
run: yarn build | |
- name: Push to Google Artifact Registry | |
if: ${{ github.actor != 'dependabot[bot]' }} | |
uses: nais/docker-build-push@v0 | |
id: docker-push | |
with: | |
team: pia | |
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} | |
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} | |
salsa: false | |
outputs: | |
image: ${{ steps.docker-push.outputs.image }} | |
deployAppToDev: | |
name: Deploy to dev-gcp | |
needs: docker-build-push | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: nais/deploy/actions/deploy@v2 | |
env: | |
CLUSTER: dev-gcp | |
IMAGE: ${{ needs.docker-build-push.outputs.image }} | |
RESOURCE: .nais/dev.yaml | |
deployAppToEksternDev: | |
name: Deploy to dev-gcp (ekstern) | |
if: github.ref == 'refs/heads/main' | |
needs: docker-build-push | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: nais/deploy/actions/deploy@v2 | |
env: | |
CLUSTER: dev-gcp | |
IMAGE: ${{ needs.docker-build-push.outputs.image }} | |
RESOURCE: .nais/ekstern-dev.yaml | |
deployAppToProd: | |
name: Deploy to prod-gcp | |
if: github.ref == 'refs/heads/main' | |
needs: docker-build-push | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: nais/deploy/actions/deploy@v2 | |
env: | |
CLUSTER: prod-gcp | |
IMAGE: ${{ needs.docker-build-push.outputs.image }} | |
RESOURCE: .nais/prod.yaml |