-
Notifications
You must be signed in to change notification settings - Fork 2
135 lines (116 loc) · 4.13 KB
/
main-migrations.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
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Deploy to production
on:
push:
branches:
- main
jobs:
apply-main-migrations:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache Node.js modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Check for changes in migrations folder
id: check_changes
run: |
git fetch origin main
if git diff --quiet HEAD^ HEAD migrations; then
echo "CHANGES=false" >> $GITHUB_ENV
else
echo "CHANGES=true" >> $GITHUB_ENV
fi
- name: Set up Node.js
if: ${{ env.CHANGES == 'true' }}
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install dependencies
if: ${{ env.CHANGES == 'true' }}
run: npm install --force
- name: Run TypeScript script
if: ${{ env.CHANGES == 'true' }}
env:
DATO_API_KEY_OPENEARTH_RWS_VIEWER: ${{ secrets.DATO_API_KEY_OPENEARTH_RWS_VIEWER }}
DATO_API_KEY_OPENEARTH_DATA_VIEWER: ${{ secrets.DATO_API_KEY_OPENEARTH_DATA_VIEWER }}
DATO_API_KEY_NL2120: ${{ secrets.DATO_API_KEY_NL2120 }}
run: npm run migrations:apply-main
prepare:
needs: apply-main-migrations
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Cache Node.js modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install dependencies
run: npm install --force
- name: Set matrix data
id: set-matrix
run: |
instances=$(node -e 'console.log(JSON.stringify(require("./config/dato/instances.js").instances))')
echo "matrix=$(echo $instances | jq -c '.')" >> $GITHUB_OUTPUT
echo "matrix is set to: $instances"
deploy-application:
needs: prepare
runs-on: ubuntu-latest
strategy:
matrix:
include: ${{ fromJson(needs.prepare.outputs.matrix) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Cache Node.js modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install dependencies
run: npm install --force
- name: Build application
run: NODE_OPTIONS="--openssl-legacy-provider" npm run build
env:
DATO_API_KEY_OPENEARTH_RWS_VIEWER: ${{ secrets.DATO_API_KEY_OPENEARTH_RWS_VIEWER }}
DATO_API_KEY_OPENEARTH_DATA_VIEWER: ${{ secrets.DATO_API_KEY_OPENEARTH_DATA_VIEWER }}
DATO_API_KEY_NL2120: ${{ secrets.DATO_API_KEY_NL2120 }}
DATO_INSTANCE_CURRENT: ${{ matrix.name }}
DATO_ENVIRONMENT: main
VUE_APP_MAPBOX_TOKEN: ${{ secrets.VUE_APP_MAPBOX_TOKEN }}
VUE_APP_API_ENDPOINT: ${{ secrets.VUE_APP_API_ENDPOINT }}
VUE_APP_AQUADESK_KEY: ${{ secrets.VUE_APP_AQUADESK_KEY }}
VUE_APP_PIWIK_CONTAINER_ID: ${{ secrets.VUE_APP_PIWIK_CONTAINER_ID }}
VUE_APP_WMR_KEY: ${{ secrets.VUE_APP_WMR_KEY }}
DEEPL_KEY: ${{ secrets.DEEPL_KEY }}
- name: Deploy to Netlify
uses: nwtgck/[email protected]
with:
publish-dir: "./dist"
production-branch: main
github-token: ${{ secrets.GITHUB_TOKEN }}
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ matrix.netlifySiteId }}