-
Notifications
You must be signed in to change notification settings - Fork 0
246 lines (225 loc) · 9.5 KB
/
Copy pathdeploy-github-pages.yml
File metadata and controls
246 lines (225 loc) · 9.5 KB
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
env:
# ###########################################################################
# FEATURES:
# ###########################################################################
#
# For offline support: (set to 'true' / 'false')
NG_USE_SERVICE_WORKER: 'true'
#
# Use the "Offers" content-type: (set to 'true' / 'false')
NG_USE_OFFERS: 'true'
#
# Use the "Q&A" content-type: (set to 'true' / 'false')
NG_USE_Q_AND_AS: 'true'
#
# When using "Q&A"s, you can enable search: (set to 'true' / 'false')
NG_USE_Q_AND_A_SEARCH: 'true'
#
# (Optional) Search-feature via API
# - Requires: NG_USE_Q_AND_A_SEARCH to be 'true'!
# - Requires: SEARCH_API to be set to the URL of the Search-API used. (See below; Set by default)
NG_USE_SEARCH_VIA_API: 'true'
# URL of the HIA-Search-API. Start with 'https://'
SEARCH_API: '${{ vars.SEARCH_API }}'
# API-Key ONLY to update the search-index with local sheet-data. Ask the host of the HIA-Search API.
SEARCH_API_KEY: ''
#
# Enable Feedback-prompt on Sub-Category and Offer pages (set to 'true' / 'false')
NG_USE_FEEDBACK_PROMPT: 'true'
#
# Use the language-switcher to switch between Regions (set to 'true' / 'false')
NG_USE_REGION_PER_LOCALE: 'false'
#
# Default language
NG_LOCALE_LANGUAGE: 'en'
# Default language direction (Possible values: 'ltr' or 'rtl')
NG_LOCALE_DIR: 'ltr'
# Available language options (Comma-separated list like: '<language-code>:<language-name>,ar:العربية,en:English,*:Other...')
# To disable the language-switcher on the main-page, or when using `NG_USE_REGION_PER_LOCALE=true`, set this to: ''
NG_LOCALE_ALTERNATIVES: 'en:English, nl:Nederlands, fr:Français, ar:العربية, *:Other...'
# An (optional) explanation below the list of available language options (i.e "* Using Google Translate")
NG_LOCALE_ALTERNATIVES_EXPLANATION: '* Translations via Google'
#
#
# For demo-purpose only: A highly visible label to show instance name/version
ENV_NAME: 'Example'
#
# ###########################################################################
# TEXT CONTENT:
# ###########################################################################
#
# A (short) name, visible in the top (navigation-)bar and in the browser's tab/window-title (and search-engine results)
TXT_APP_NAME: 'Helpful \n Information'
# An absolute/data-URL to an image, visible in the top (navigation-)bar
TXT_APP_LOGO_URL: 'https://helpful-info.github.io/example/files/helpful-info_logo.webp'
# The first heading, (only) visible on the main-page
TXT_MAIN_PAGE_HEADER: 'Welcome'
# The (optional) introduction text, (only) visible on the main-page.
# Can be multiple-lines of Markdown syntax or contain some HTML. Newlines need to be specified with `\n` or `<br />`.
TXT_MAIN_PAGE_INTRO: >-
This example-site shows how you can provide Helpful Information. \n
\n
Please choose a topic:
#
# An (optional) notice on the top of the screen, can be overwritten on sub-pages per-region by each region's sheet.
TXT_MAIN_PAGE_NOTICE: ''
#
# An (optional) "About"-page
# Can be multiple-lines of Markdown syntax or contain some HTML. Newlines need to be specified with `\n` or `<br />`.
TXT_PAGE_ABOUT: >-
## About \n
\n
This is an example of a [Helpful Information App](https://github.com/rodekruis/helpful-information#readme).\n
\n
All possible features are enabled and configured in this instance. \n
The configuration of _**this** specific_ instance, can be found in [its own GitHub-repository](https://github.com/helpful-info/example/blob/main/.github/workflows/deploy-github-pages.yml).\n
\n
There is also a website of a [multilingual-example](https://helpful-info.github.io/example-multilingual).\n
#
# An (optional) "Privacy"-page
# Can be multiple-lines of Markdown syntax or contain some HTML. Newlines need to be specified with `\n` or `<br />`.
TXT_PAGE_PRIVACY: >-
## Privacy \n
\n
We do not collect any personal information or location data on this website. \n
Feel free to explore our site anonymously.\n
\n
The Helpful Information Team\n
\n
#
# An (optional) footer at the bottom of the screen, can be overwritten on sub-pages per-region by each region's sheet.
TXT_MAIN_FOOTER: >-
**Helpful Information** \n
\n
[About](/example/about) \n
[Privacy](/example/privacy) \n
#
# Contents of the 'error-page'
#
TXT_ERROR_HEADER: 'Data Unavailable'
# This Sentence will be followd by a link to the "Contact-URL" set below
TXT_ERROR_MESSAGE: 'Reach out to us at: '
# Provide a URL that has contact-information on it, or a `mailto:contact@example.org`-URL
TXT_ERROR_CONTACT_URL: 'https://github.com/${{ github.repository }}'
# Call to action on a link that will reload the current page
TXT_ERROR_RETRY: 'Try again?'
#
# ###########################################################################
# REGIONS/SHEETS:
# ###########################################################################
#
# When defining multiple regions/sheets, the order in the following 3 variables need to match.
# The last option in each list should NOT contain a comma (,) at the end.
#
# So in this example:
# <REGION> = <REGION__LABEL> = <REGION__SHEET_ID>
# "test" = "Test/Development" = "10SIJdAQSd6loqCyzwK409QS_01Fgp8P4aqoDO8iBvhY"
#
# The URL-part(s) to identify the region
REGIONS: >-
demo,
test
# The readable label(s) on the link to the region-page
REGIONS_LABELS: >-
Demo,
Test/Development
# The ID of the Google Sheet(s) that contains the content for the region
REGIONS_SHEET_IDS: >-
1op6Ouyxtwv4f8GAEAMSn5PVzcXtfZuftMiLYWsX0pbs,
10SIJdAQSd6loqCyzwK409QS_01Fgp8P4aqoDO8iBvhY
#
# ###########################################################################
# Analytics/Monitoring:
# ###########################################################################
#
# Matomo;
MATOMO_CONNECTION_STRING: '${{ vars.MATOMO_CONNECTION_STRING }}'
# GoatCounter;
GOATCOUNTER_CONNECTION_STRING: '${{ vars.GOATCOUNTER_CONNECTION_STRING }}'
# Azure Monitor / ApplicationInsights;
AI_CONNECTION_STRING: '${{ vars.AI_CONNECTION_STRING }}'
# #############################################################################
#
# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
#
# #############################################################################
name: Deploy to GitHub Pages
on:
workflow_dispatch:
push:
branches: ['main']
permissions:
actions: read
contents: read
pages: write
id-token: write
concurrency:
group: 'pages'
cancel-in-progress: true
jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Verify ENV configuration
if: env.REGIONS_SHEET_IDS == 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
run: |
echo "### ⚠️ Missing Google Spreadsheet ID" >> $GITHUB_STEP_SUMMARY
echo "Set the appropriate Google Spreadsheet ID in \`REGIONS_SHEET_IDS\`, instead of the default/placeholder-value: \`xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\`" >> $GITHUB_STEP_SUMMARY
echo "Edit [\`.github/workflows/deploy-github-pages.yml\`](../../edit/main/.github/workflows/deploy-github-pages.yml) to fix." >> $GITHUB_STEP_SUMMARY
echo "::error file=.github/workflows/deploy-github-pages.yml::Please change the ENV configuration to real-world values" && exit 1
- name: Detect GitHub Pages URL
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
public_url="$(gh api repos/"$GITHUB_REPOSITORY"/pages --jq '.html_url')"
echo "HIA_PUBLIC_URL=$public_url" >> "$GITHUB_ENV"
- name: Show GitHub Pages URL
run: |
echo "The public URL is: $HIA_PUBLIC_URL"
- name: Checkout
uses: actions/checkout@v7
- name: Set up Node.js version
uses: actions/setup-node@v6
with:
node-version-file: 'package.json'
cache-dependency-path: 'package.json'
cache: 'npm'
- name: Install local
run: 'npm install --no-save'
- name: Set-up helpful-information
run: 'mv node_modules/helpful-information ./'
- name: Install helpful-information
working-directory: 'helpful-information'
run: 'npm ci --no-fund --no-audit'
env:
HUSKY: 0
- name: Build
working-directory: 'helpful-information'
# NOTE: When the instance will be run on a custom (sub-)domain, remove the `--base-href`-flag+value.
run: 'npm run build:production -- --base-href=/${GITHUB_REPOSITORY#*/}/'
env:
# See all variables: https://github.com/rodekruis/helpful-information/blob/main/.env.example
NG_PRODUCTION: 'true'
GOOGLE_SHEETS_API_KEY: '${{ secrets.GOOGLE_SHEETS_API_KEY }}'
GOOGLE_SHEETS_API_URL: 'https://sheets.googleapis.com/v4/spreadsheets'
- name: Move generated files
run: 'mv ./helpful-information/www ./'
- name: Add generic files
run: 'cp -r ./public/. www/'
- name: Add 404.html
run: 'cp www/index.html www/404.html'
- name: Setup GitHub Pages
uses: actions/configure-pages@v6
with:
enablement: true
- name: Upload artifact
uses: actions/upload-pages-artifact@v5
with:
path: 'www'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5