Find a way to secure certain FAQ's #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# More information on Static Web App workflow configurations, | |
# See: https://aka.ms/swaworkflowconfig | |
# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions | |
name: 'private-FAQ: Deploy Azure' | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths: | |
- '!.github/**' | |
- '.github/workflows/deploy-private-faq.yml' | |
- '.azure/local-data/**' | |
- '*' | |
- '!*.md' | |
- 'src/**' | |
pull_request: | |
types: [opened, synchronize, reopened, closed] | |
branches: | |
- main | |
paths: | |
- '!.github/**' | |
- '.github/workflows/deploy-private-faq.yml' | |
- '.azure/local-data/**' | |
- '*' | |
- '!*.md' | |
- 'src/**' | |
issue_comment: | |
types: [created] | |
jobs: | |
build_and_deploy: | |
environment: 'private-faq' | |
if: > | |
github.event_name == 'workflow_dispatch' || | |
github.event_name == 'push' || | |
(github.event_name == 'pull_request' && github.event.action != 'closed') || | |
( | |
github.event_name == 'issue_comment' && | |
github.event.issue.number == vars.GHA_DEPLOY_TRIGGER_ISSUE && | |
contains(github.event.issue.assignees.*.login, github.event.comment.user.login) && | |
github.event.comment.body == '/update private-faq' | |
) | |
runs-on: ubuntu-latest | |
name: Build and Deploy | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Node.js version | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.node-version' | |
cache: 'npm' | |
- name: Install | |
env: | |
HUSKY: 0 | |
run: 'npm ci --no-fund --no-audit' | |
- name: Set/override favicon.ico | |
run: 'cp --force src/favicon.gold.ico src/favicon.ico' | |
- name: Build | |
run: 'npm run build:production' | |
env: | |
NG_PRODUCTION: 'true' | |
ENV_NAME: 'Private-FAQ' | |
NG_USE_SERVICE_WORKER: 'true' | |
NG_USE_OFFERS: 'true' | |
NG_USE_Q_AND_AS: 'true' | |
NG_USE_Q_AND_A_SEARCH: 'true' | |
TXT_APP_NAME: 'Aidworker FAQ' | |
TXT_APP_LOGO_URL: 'https://rodekruis.github.io/510-ICON-LIBRARY/Beeldmerk_van_het_Nederlandse_Rode_Kruis.svg' | |
TXT_MAIN_PAGE_HEADER: 'Hello Aidworker!' | |
TXT_MAIN_PAGE_INTRO: >- | |
This website contains internal FAQs only.\n | |
\n | |
To view the public FAQ, visit:\n | |
<https://helpfulinformation-faq.redcross.nl/> \n | |
\n | |
<a href="/login" class="action"><strong>🔐 Login</strong></a>\n | |
\n | |
When on a public device, you can: [**Logout**](/logout)\n | |
\n | |
TXT_ERROR_HEADER: 'Data Unavailable' | |
TXT_ERROR_MESSAGE: 'Reach out to us at: ' | |
TXT_ERROR_CONTACT_URL: 'https://www.rodekruis.nl/' | |
TXT_ERROR_RETRY: 'Try again?' | |
REGIONS: >- | |
private, | |
REGIONS_LABELS: >- | |
Private FAQ, | |
REGIONS_SHEET_IDS: >- | |
1QsmCBZ7j1sgOwo7sXjI8Jln_jw68oL1gyRvvzj3dHII, | |
GOOGLE_SHEETS_API_URL: '/data' | |
AI_CONNECTION_STRING: 'InstrumentationKey=92c7559a-1554-4e7b-b86c-afe18c15b64c;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/' | |
- name: Set/override robots.txt | |
run: 'cp src/robots.private.txt www/robots.txt' | |
- name: Install Google Sheets API SDK | |
run: 'npm install googleapis@^128.0.0 --no-save' | |
- name: Download sheet data | |
env: | |
GOOGLE_SHEETS_API_SERVICE_ACCOUNT: ${{ secrets.GOOGLE_SHEETS_API_SERVICE_ACCOUNT }} | |
run: | | |
echo "Downloading sheet data: ..." | |
node ./.azure/local-data/download-google-sheets.js 1QsmCBZ7j1sgOwo7sXjI8Jln_jw68oL1gyRvvzj3dHII | |
echo "Downloading sheet data: done" | |
- name: Deploy to Azure | |
uses: Azure/static-web-apps-deploy@v1 | |
with: | |
skip_deploy_on_missing_secrets: true | |
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_AGREEABLE_FOREST_090D2F903 }} | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
action: 'upload' | |
config_file_location: '.azure/local-data/' | |
app_location: 'www' | |
output_location: '' | |
skip_app_build: true | |
skip_api_build: true | |
close_pull_request_job: | |
if: github.event_name == 'pull_request' && github.event.action == 'closed' | |
runs-on: ubuntu-latest | |
name: Close Pull Request | |
environment: 'private-faq' | |
steps: | |
- name: Close Pull Request for Production | |
uses: Azure/static-web-apps-deploy@v1 | |
with: | |
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_AGREEABLE_FOREST_090D2F903 }} | |
action: 'close' |