This repository has been archived by the owner on Nov 18, 2024. It is now read-only.
Endret tillatelser #8
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: Deploy to prod-gcp | |
on: | |
push: | |
branches: [ main ] | |
env: | |
IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }} | |
jobs: | |
build: | |
name: Build and push docker container | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
id-token: write | |
environment: production | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- name: Yarn install | |
run: yarn install | |
- name: Yarn build | |
run: yarn build | |
- uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Re-tag and publish image | |
run: | | |
docker build -t ${{ env.IMAGE }} . | |
docker push ${{ env.IMAGE }} | |
deploy: | |
name: Deploy to prod-gcp | |
needs: build | |
environment: production | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v4 | |
- name: Deploy to prod | |
uses: nais/deploy/actions/deploy@v2 | |
env: | |
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
CLUSTER: prod-gcp | |
RESOURCE: nais.yaml | |
IMAGE: ${{ env.IMAGE }} | |
PRINT_PAYLOAD: true |