-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (52 loc) · 1.72 KB
/
deploy-to-prod.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Manual deploy to prod
on:
workflow_call:
secrets:
NAIS_WORKLOAD_IDENTITY_PROVIDER:
description: "Identity provider for nais/docker-build-push"
required: true
READER_TOKEN:
description: "Token for reading from GitHub Package Registry"
required: true
workflow_dispatch:
run-name: Prod deploy of ${{ github.ref_name }}
jobs:
deploy_to_prod:
name: Deploy
if: github.ref == 'refs/heads/main'
permissions:
contents: write
id-token: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get image registry
id: image-registry
uses: nais/login@v0
with:
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
team: klage
- name: Generate image name
id: image
shell: bash
run: echo "image=${{ steps.image-registry.outputs.registry }}/kabal-frontend:${{ github.sha }}" >> $GITHUB_OUTPUT
- name: Deploy to prod
uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: prod-gcp
VARS: nais/prod.yaml
RESOURCE: nais/nais.yaml
VAR: image=${{ steps.image.outputs.image }}
timeout-minutes: 3
- name: Generate release version
id: release
run: |
COMMIT=$(git rev-parse --short=7 HEAD)
VERSION=$(TZ="Europe/Oslo" git show -s --format=%cd --date='format-local:%Y-%m-%dT%H.%M.%S')
RELEASE=$VERSION-$COMMIT
echo "release=${RELEASE}" >> $GITHUB_OUTPUT
- uses: ncipollo/release-action@v1
with:
tag: ${{ steps.release.outputs.release }}