-
Notifications
You must be signed in to change notification settings - Fork 5
77 lines (74 loc) · 2.31 KB
/
deploy-ekstern.yml
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: GCP root
on:
workflow_call:
inputs:
kommando:
required: true
type: string
bucket:
required: true
type: string
NAIS_MANAGEMENT_PROJECT_ID:
required: true
type: string
secrets:
SENTRY_AUTH_TOKEN:
required: false
READER_TOKEN:
required: true
SLACK_WEBHOOK:
required: false
NAIS_WORKLOAD_IDENTITY_PROVIDER:
required: true
jobs:
deploy:
name: Deploy to GCP-bucket
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: "https://npm.pkg.github.com"
cache: 'npm'
- name: Install dependencies
run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
- name: Run tests
run: npm run test
- name: Build application
run: ${{ inputs.kommando }}
- name: Upload to CDN
uses: nais/deploy/actions/cdn-upload/v2@master
with:
team: dab
source: ./build/
destination: /${{ inputs.bucket }}/
no_cache_paths: ${{ inputs.bucket }}/build/index.html
project_id: ${{ inputs.NAIS_MANAGEMENT_PROJECT_ID }}
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
- name: Create sentry release
uses: getsentry/action-release@v1
if: inputs.bucket == 'aktivitetsplan-prod'
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: nav
SENTRY_PROJECT: aktivitetsplan
SENTRY_URL: https://sentry.gc.nav.no/
with:
environment: prod
sourcemaps: './build'
url_prefix: '~'
- name: Slack Notification (deploy failure)
if: failure() && inputs.bucket == 'aktivitetsplan-prod'
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: danger
SLACK_USERNAME: Github Actions
SLACK_ICON: https://github.com/github.png?size=48
SLACK_TITLE: 'Aktivitetsplan: deploy til bucket for eksterne brukere feilet'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_MESSAGE: 'Commit-message til feilende deploy: ${{ github.event.head_commit.message }}'