This repository has been archived by the owner on Dec 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (106 loc) · 3.38 KB
/
main.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Test, build and update
on: push
env:
CI: true
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/master' && github.ref != 'refs/heads/dev'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm run test
update-dev:
name: Upload files to dev GCS
if: github.ref == 'refs/heads/dev'
runs-on: ubuntu-latest
permissions:
id-token: 'write' # Used to authenticate with Google Cloud
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm run test
- name: Build application
run: npm run build
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v1
with:
workload_identity_provider: projects/168288490841/locations/global/workloadIdentityPools/github/providers/github-action
service_account: pto-dev-2fbb@appspot.gserviceaccount.com
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v0
- name: Upload files to GCS
run: gsutil -m rsync -r build gs://behovsvurdering-dev
update-gh-pages:
name: Update GitHub pages
runs-on: ubuntu-latest
permissions:
id-token: 'write' # Used to authenticate with Google Cloud
if: github.ref == 'refs/heads/dev'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build mock application
run: npm run build:mock
- name: Update GitHub pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
update-prod:
name: Upload files to prod GCS
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
permissions:
id-token: 'write' # Used to authenticate with Google Cloud
contents: 'write' # Create release
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm run test
- name: Build application
run: npm run build
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v1
with:
workload_identity_provider: projects/230235624122/locations/global/workloadIdentityPools/github/providers/github-action
service_account: pto-prod@pto-prod-4dd0.iam.gserviceaccount.com
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v0
- name: Upload files to GCS
run: gsutil -m rsync -r build gs://behovsvurdering-prod
- name: Create release
uses: softprops/action-gh-release@v1
with:
name: Production environment updated
target_commitish: master
tag_name: release/prod@${{ github.sha }}