Skip to content

Commit d6a6dff

Browse files
committed
Groom
1 parent 3eb46f6 commit d6a6dff

9 files changed

+145
-72
lines changed

.github/workflows/deploy-master-to-live.yml

+5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ jobs:
1313
with:
1414
ref: master
1515

16+
- name: Set up Node.js
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: '22'
20+
1621
- name: Build the site
1722
run: ./build.sh
1823

.github/workflows/deploy-preview-to-live.yml

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ jobs:
1414
ref: preview
1515
fetch-depth: 0
1616

17+
- name: Set up Node.js
18+
uses: actions/setup-node@v3
19+
with:
20+
node-version: '22'
1721

1822
- name: Build the site
1923
run: ./build.sh

.github/workflows/deploy-preview.yml

+5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ jobs:
1313
with:
1414
ref: preview
1515

16+
- name: Set up Node.js
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: '22'
20+
1621
- name: Build the site
1722
run: ./build.sh
1823

.github/workflows/fetch-and-deploy-preview.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ jobs:
1111
- name: Checkout repository
1212
uses: actions/checkout@v4
1313

14+
- name: Set up Node.js
15+
uses: actions/setup-node@v3
16+
with:
17+
node-version: '22'
18+
1419
- name: Pull documents from Notion
1520
run: ./pull_docs.sh --skip-pulling-from-s3
1621
env:
@@ -19,8 +24,8 @@ jobs:
1924

2025
- name: Commit changes
2126
run: |
22-
git config user.name "github-actions[bot]"
23-
git config user.email "github-actions[bot]@users.noreply.github.com"
27+
git config user.name "github"
28+
git config user.email ""
2429
git add .
2530
git commit -m "Update files from Notion"
2631
@@ -30,7 +35,7 @@ jobs:
3035
- name: Push changes to preview branch
3136
env:
3237
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33-
run: git push -f origin HEAD:preview
38+
run: git push --force origin HEAD:preview
3439

3540
- name: Deploy preview to Netlify
3641
run: ./deploy.sh --github-action-preview-subdomain

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2023 SIL International
3+
Copyright (c) 2023 SIL Global
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

build.sh

+12-16
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,16 @@ set -euxo pipefail
55
npm install
66
npm run build
77

8-
# Copy the help files to their respective locales in the build directory
8+
# Locales and their destination directories
9+
declare -A directory_for_locale=(
10+
["en"]="manual"
11+
["es"]="es/manual"
12+
["fr"]="fr/manual"
13+
["pt_BR"]="pt-BR/manual"
14+
)
915

10-
# English
11-
mkdir -p build/manual
12-
cp -r s3/en/* build/manual
13-
14-
# Spanish
15-
mkdir -p build/es/manual
16-
cp -r s3/es/* build/es/manual
17-
18-
# French
19-
mkdir -p build/fr/manual
20-
cp -r s3/fr/* build/fr/manual
21-
22-
# Portuguese
23-
mkdir -p build/pt-BR/manual
24-
cp -r s3/pt_BR/* build/pt-BR/manual
16+
locales=("${!directory_for_locale[@]}")
17+
for locale in "${locales[@]}"; do
18+
mkdir --parents "build/${directory_for_locale[$locale]}"
19+
cp -r s3/$locale/* "build/${directory_for_locale[$locale]}"
20+
done

deploy.sh

+26-8
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,31 @@
22

33
set -euxo pipefail
44

5-
# NETLIFY_AUTH_TOKEN must be set in the environment
5+
if [[ -z "${NETLIFY_AUTH_TOKEN-}" ]]; then
6+
echo "Error: NETLIFY_AUTH_TOKEN is not set."
7+
exit 1
8+
fi
9+
610
export NETLIFY_SITE_ID=aba3890d-2b7b-4144-883f-7c600965db82
711

8-
if (( "$#" == 1 )) && [[ "$1" == "--github-action-preview-subdomain" ]]; then
9-
npx netlify deploy --dir build --alias github-action-preview
10-
elif (( "$#" == 1 )) && [[ "$1" == "--prod" ]]; then
11-
npx netlify deploy --dir build --prod
12-
else
13-
npx netlify deploy --dir build
14-
fi
12+
deploy() {
13+
local deploy_args=("--dir" "build")
14+
while (("$#")); do
15+
case "$1" in
16+
--github-action-preview-subdomain)
17+
deploy_args+=("--alias" "github-action-preview")
18+
;;
19+
--prod)
20+
deploy_args+=("--prod")
21+
;;
22+
*)
23+
echo "Error: Unknown argument: $1"
24+
exit 1
25+
;;
26+
esac
27+
shift
28+
done
29+
npx netlify deploy "${deploy_args[@]}"
30+
}
31+
32+
deploy "$@"

docusaurus.config.js

+56-40
Original file line numberDiff line numberDiff line change
@@ -3,80 +3,96 @@
33

44
/** @type {import('@docusaurus/types').Config} */
55
const config = {
6-
title: 'Scripture Forge Help',
7-
favicon: 'img/favicon.ico',
8-
url: 'https://help.scriptureforge.org',
9-
baseUrl: '/',
10-
onBrokenLinks: 'throw',
11-
onBrokenMarkdownLinks: 'warn',
6+
title: "Scripture Forge Help",
7+
favicon: "img/favicon.ico",
8+
url: "https://help.scriptureforge.org",
9+
baseUrl: "/",
10+
onBrokenLinks: "throw",
11+
onBrokenMarkdownLinks: "warn",
1212
i18n: {
13-
defaultLocale: 'en',
14-
locales: ['en', 'fr', 'es', 'pt-BR', 'de']
13+
defaultLocale: "en",
14+
locales: ["en", "fr", "es", "pt-BR", "de"],
1515
},
1616

1717
presets: [
1818
[
19-
'classic',
19+
"classic",
2020
/** @type {import('@docusaurus/preset-classic').Options} */
2121
({
2222
docs: {
23-
routeBasePath: '/',
24-
sidebarPath: require.resolve('./sidebars.js')
23+
routeBasePath: "/",
24+
sidebarPath: require.resolve("./sidebars.js"),
2525
},
2626
theme: {
27-
customCss: require.resolve('./src/css/custom.css')
28-
}
29-
})
30-
]
27+
customCss: require.resolve("./src/css/custom.css"),
28+
},
29+
}),
30+
],
3131
],
3232

3333
themeConfig:
3434
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
3535
({
3636
navbar: {
37-
title: 'Scripture Forge Help',
37+
title: "Scripture Forge Help",
3838
logo: {
39-
alt: 'Scripture Forge Logo',
40-
src: 'img/sf.svg'
39+
alt: "Scripture Forge Logo",
40+
src: "img/sf.svg",
4141
},
4242
items: [
43-
{ href: 'https://scriptureforge.org', label: 'Back to Scripture Forge', position: 'right' },
44-
{ type: 'localeDropdown', position: 'right' }
45-
]
43+
{
44+
href: "https://scriptureforge.org",
45+
label: "Back to Scripture Forge",
46+
position: "right",
47+
},
48+
{ type: "localeDropdown", position: "right" },
49+
],
4650
},
4751
footer: {
48-
style: 'dark',
52+
style: "dark",
4953
copyright: `Copyright © ${new Date().getFullYear()} SIL International`,
5054
links: [
5155
{
52-
title: 'Resources',
56+
title: "Resources",
5357
items: [
5458
// pathname:// informs Docusaurus that this should not be handled as part of the SPA
5559
// See https://docusaurus.io/docs/next/advanced/routing#escaping-from-spa-redirects
56-
{ label: 'Manual', href: 'pathname:///manual' },
60+
{ label: "Manual", href: "pathname:///manual" },
5761
{
58-
label: 'Change log',
59-
href: 'https://community.scripture.software.sil.org/t/scripture-forge-announcements/1776'
60-
}
61-
]
62+
label: "Change log",
63+
href: "https://community.scripture.software.sil.org/t/scripture-forge-announcements/1776",
64+
},
65+
],
6266
},
6367
{
64-
title: 'Support',
68+
title: "Support",
6569
items: [
66-
{ label: 'Community site', href: 'https://community.scripture.software.sil.org/c/scripture-forge/19' },
67-
{ label: 'Email support', href: 'mailto:[email protected]' }
68-
]
70+
{
71+
label: "Community site",
72+
href: "https://community.scripture.software.sil.org/c/scripture-forge/19",
73+
},
74+
{
75+
label: "Email support",
76+
href: "mailto:[email protected]",
77+
},
78+
],
6979
},
7080
{
71-
title: 'Legal',
81+
title: "Legal",
7282
items: [
73-
{ label: 'Terms of Use', href: 'https://scriptureforge.org/terms' },
74-
{ label: 'Privacy policy', href: 'https://scriptureforge.org/privacy' }
75-
]
76-
}
77-
]
78-
}
79-
})
83+
{
84+
label: "Terms of Use",
85+
href: "https://scriptureforge.org/terms",
86+
},
87+
{
88+
label: "Privacy policy",
89+
href: "https://scriptureforge.org/privacy",
90+
},
91+
],
92+
},
93+
],
94+
},
95+
}),
8096
};
8197

8298
module.exports = config;

pull_docs.sh

+28-4
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,40 @@
22

33
set -euxo pipefail
44

5+
if [[ -z "${SF_HELP_NOTION_TOKEN-}" ]]; then
6+
echo "Error: SF_HELP_NOTION_TOKEN is not set."
7+
exit 1
8+
fi
9+
if [[ -z "${SF_HELP_NOTION_ROOT_PAGE_ID-}" ]]; then
10+
echo "Error: SF_HELP_NOTION_ROOT_PAGE_ID is not set."
11+
exit 1
12+
fi
13+
14+
skip_pulling_from_s3=false
15+
while (("$#")); do
16+
case "$1" in
17+
--skip-pulling-from-s3)
18+
skip_pulling_from_s3=true
19+
shift
20+
;;
21+
*)
22+
echo "Unknown argument: $1"
23+
exit 1
24+
;;
25+
esac
26+
done
27+
528
# Download the help files from Notion
629
npm install
7-
npx @sillsdev/docu-notion@latest -n $SF_HELP_NOTION_TOKEN -r $SF_HELP_NOTION_ROOT_PAGE_ID --image-file-name-format legacy
30+
npx @sillsdev/docu-notion@latest -n "${SF_HELP_NOTION_TOKEN}" -r "${SF_HELP_NOTION_ROOT_PAGE_ID}" --image-file-name-format legacy
831

932
# Needed for the current version of docu-notion; this can be removed once it publishes a new release
10-
sed -i s/:::📝/:::note/g docs/*.md
33+
sed -i 's/:::📝/:::note/g' docs/*.md
34+
1135
# Add a div around the ReactPlayer component to make it responsive
1236
sed -i -e '/<ReactPlayer/ s/^/<div class="player-wrapper">/' -e '/<ReactPlayer/ s/$/<\/div>/' docs/*.md
13-
14-
if (( "$#" == 1 )) && [[ "$1" == "--skip-pulling-from-s3" ]]; then
37+
38+
if [[ "${skip_pulling_from_s3}" = true ]]; then
1539
echo "Skipping pulling from S3."
1640
else
1741
mkdir -p s3

0 commit comments

Comments
 (0)