Build and deploy app || Fjerne ubrukt styling #1288
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 | |
- mer-om-statistikk | |
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: 20 | |
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 }} | |
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 | |
trivy-scan: | |
name: Scanner docker image med Trivy | |
if: github.ref == 'refs/heads/main' | |
needs: docker-build-push | |
permissions: | |
contents: read # to write sarif | |
security-events: write # push sarif to GitHub security | |
id-token: write # for nais/login | |
runs-on: ubuntu-latest | |
steps: | |
- uses: navikt/pia-actions/trivy-scan@v1 # https://github.com/navikt/pia-actions/tree/main/trivy-scan | |
with: | |
image: ${{ needs.docker-build-push.outputs.image }} | |
team: pia | |
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} | |
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} |