Skip to content

Commit

Permalink
Nytt deploy opplegg
Browse files Browse the repository at this point in the history
  • Loading branch information
eilifjohansen committed Nov 23, 2024
1 parent 92bf9dd commit 99041ec
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions .github/workflows/deploy_dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
push:
branches: [ master ]

env:
IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}

jobs:
build:
name: Build and push docker conatainer
Expand All @@ -15,28 +12,32 @@ jobs:
permissions:
packages: write
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up node
uses: actions/setup-node@v4
with:
node-version: "20.x"
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v5
- name: 'Build and push'
uses: nais/docker-build-push@v0
id: docker-build-push
with:
context: .
push: true
tags: ${{ env.IMAGE }}
team: team-researchops
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}

outputs:
image: ${{ steps.docker-build-push.outputs.image }}

deploy-dev:
name: Deploy to dev-gcp
needs: build
environment: production
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout branch
uses: actions/checkout@v4
Expand Down Expand Up @@ -70,17 +71,19 @@ jobs:
- name: Deploy to prod
uses: nais/deploy/actions/deploy@v2
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: .nais/dev-gcp.yaml
VAR: image=${{ env.IMAGE }}
VAR: image=${{ needs.build.outputs.image }},version=${{ github.sha }}
VARS: .nais/vars.yaml

deploy-prod:
name: Deploy to prod-gcp
needs: deploy-dev
environment: production
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout branch
uses: actions/checkout@v4
Expand Down Expand Up @@ -114,8 +117,7 @@ jobs:
- name: Deploy to prod
uses: nais/deploy/actions/deploy@v2
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: prod-gcp
RESOURCE: .nais/prod-gcp.yaml
VAR: image=${{ env.IMAGE }}
VAR: image=${{ needs.build.outputs.image }},version=${{ github.sha }}
VARS: .nais/vars.yaml

0 comments on commit 99041ec

Please sign in to comment.