kriterier er noen ganger undefined #110
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 docker image and create issue | |
on: | |
push: | |
paths-ignore: | |
- '**.md' | |
- '.gitignore' | |
- 'CODEOWNERS' | |
- 'LICENCE' | |
- 'e2e/**' | |
- '.github/workflows/e2e-docker-image.yml' | |
branches: | |
- master | |
jobs: | |
build-and-deploy: | |
name: Build docker image and create issue | |
runs-on: ubuntu-latest | |
permissions: | |
actions: read | |
contents: read | |
id-token: write | |
issues: write | |
outputs: | |
image: ${{ steps.docker-push.outputs.image }} | |
image_version: ${{ env.DOCKER_METADATA_OUTPUT_VERSION }} | |
steps: | |
- name: Hente kode | |
uses: actions/checkout@v4 | |
- name: Sette yarn-config | |
run: | | |
yarn config set npmScopes.navikt.npmRegistryServer "https://npm.pkg.github.com" | |
yarn config set npmScopes.navikt.npmAlwaysAuth true | |
yarn config set npmScopes.navikt.npmAuthToken $NPM_AUTH_TOKEN | |
env: | |
NPM_AUTH_TOKEN: ${{ secrets.READER_TOKEN }} | |
- name: Sette opp Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
cache: yarn | |
- name: Installere dependencies | |
run: yarn install --immutable | |
- name: CSS lint | |
run: yarn css:lint | |
- name: Tester | |
run: yarn test --maxWorkers=2 | |
- name: Bygge kode | |
run: yarn build | |
- name: Opprett release med Sentry | |
run: yarn sentry-release | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
- uses: nais/docker-build-push@v0 | |
id: docker-push | |
with: | |
tag: 'latest' | |
team: k9saksbehandling | |
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} | |
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} | |
- name: Lukk gamle issues | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
github.rest.issues.listForRepo({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
state: 'open', | |
labels: ['deployment'] | |
}).then(response => { | |
response.data.forEach(issue => { | |
github.rest.issues.update({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: issue.number, | |
state: 'closed' | |
}); | |
}); | |
}); | |
- name: Opprett deployment issue | |
id: createdeployissue | |
if: success() | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
github.rest.issues.create( { | |
owner: context.issue.owner, | |
repo: context.issue.repo, | |
labels: ['deployment'], | |
body: 'Kommenter enten "/promote dev-gcp" eller "/promote prod-gcp" for å deploye ${{ github.sha }}', | |
title: 'Deploy av ${{ env.DOCKER_METADATA_OUTPUT_VERSION }}'}) | |
.then(response => { | |
core.setOutput('number', response.data.number); | |
}); | |
- name: Trigg deploy til dev-gcp | |
if: success() | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{secrets.GH_SSO_REPO_TOKEN}} | |
script: | | |
const issue = { owner: context.issue.owner, | |
repo: context.issue.repo, | |
issue_number: ${{ steps.createdeployissue.outputs.number }} } | |
github.rest.issues.createComment({...issue, body: '/promote dev-gcp'}) | |
trigger-verdikjede: | |
name: Trigger verdikjede test | |
needs: [build-and-deploy] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Trigger test | |
run: | | |
curl -L \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{secrets.GH_SSO_REPO_TOKEN}}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/navikt/k9-verdikjede/actions/workflows/build-los.yml/dispatches \ | |
-d '{"ref":"master", | |
"inputs":{ | |
"trigger": "${{ github.repository }}", | |
"run_id": "${{ github.run_id }}", | |
"version": "${{ needs.build-and-deploy.outputs.image_version}}" | |
}}' | |
trivy: | |
needs: [build-and-deploy] | |
uses: navikt/sif-gha-workflows/.github/workflows/trivy.yml@main | |
permissions: | |
contents: write | |
id-token: write | |
security-events: write | |
actions: read | |
secrets: inherit | |
with: | |
image: ${{ needs.build-and-deploy.outputs.image }} | |
team: k9saksbehandling |