Build and deploy app || Bytt til @amplitude/analytics-browser (#184) * Bytt ut amplitude-js med @amplitude/analytics-browser * Fix linting * Add https to server URL * Fjerner navigere-event (måtte ha en ugrei preventDefault på lenkene) * Fiks lenke til min side arbeidsgiver i dev #1229
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 | |
- amplitude-browser | |
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 |