Build and deploy app || Forenkle ia metrikkene (#185) * Legger på kall til IA-metrikker etter fem sekunder på alle undersider * Fjerner alle andre kall til Ia-metrikkene * Skriver tester for metrikkutsendelser #1234
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 | |
- forenkle-ia-metrikkene | |
paths-ignore: | |
- "**.md" | |
- "**/**.md" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
docker-build-push: | |
name: Build, test and push docker image | |
permissions: | |
contents: read | |
id-token: write | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
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: teamia | |
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@v3 | |
- uses: nais/deploy/actions/deploy@v1 | |
env: | |
CLUSTER: dev-gcp | |
IMAGE: ${{ needs.docker-build-push.outputs.image }} | |
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
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@v3 | |
- uses: nais/deploy/actions/deploy@v1 | |
env: | |
CLUSTER: dev-gcp | |
IMAGE: ${{ needs.docker-build-push.outputs.image }} | |
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
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@v3 | |
- uses: nais/deploy/actions/deploy@v1 | |
env: | |
CLUSTER: prod-gcp | |
IMAGE: ${{ needs.docker-build-push.outputs.image }} | |
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
RESOURCE: .nais/prod.yaml |