Skip to content

Commit

Permalink
Add run.sh script to project (#2517)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaharagon committed Apr 11, 2024
1 parent a806539 commit a0aa107
Show file tree
Hide file tree
Showing 14 changed files with 304 additions and 286 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"name": "Privacy Guides",
"image": "ghcr.io/squidfunk/mkdocs-material:9.5.17",
"forwardPorts": [8000],
"postCreateCommand": "git submodule init; git submodule update theme/assets/brand; mkdocs serve --dev-addr=0.0.0.0:8000"
"postCreateCommand": "git submodule init; git submodule update theme/assets/brand; ./run.sh"
}
2 changes: 1 addition & 1 deletion .devcontainer/team/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"name": "Privacy Guides Team",
"image": "ghcr.io/privacyguides/privacyguides.org:main",
"forwardPorts": [8000],
"postCreateCommand": "git submodule init; git submodule update theme/assets/brand; mkdocs serve --dev-addr=0.0.0.0:8000 --config-file mkdocs-production.yml"
"postCreateCommand": "git submodule init; git submodule update theme/assets/brand; ./run.sh --cmd=mkdocs --insiders --production --cmd_flags=--dev-addr=0.0.0.0:8000"
}
68 changes: 6 additions & 62 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,62 +45,20 @@ jobs:
run: |
{
echo "BUILD_CONTEXT=${{ inputs.context }}"
echo "BUILD_EDIT_URI_TEMPLATE=blob/main/docs/{path}?plain=1"
echo "BUILD_REPO_URL=https://github.com/privacyguides/privacyguides.org"
echo "PRODUCTION=true"
echo "EXTRA_FLAGS=""$EXTRA_FLAGS" --production""
} >> "$GITHUB_ENV"
- name: Set Metadata for Privileged Builds
if: inputs.privileged
run: echo "BUILD_INSIDERS=true" >> "$GITHUB_ENV"
run: |
echo "BUILD_INSIDERS=true" >> "$GITHUB_ENV"
echo "EXTRA_FLAGS=""$EXTRA_FLAGS" --insiders"" >> "$GITHUB_ENV"
- name: Set Metadata for Offline Mode
if: inputs.config == 'offline'
run: |
{
echo "BUILD_EDIT_URI_TEMPLATE=''"
echo "BUILD_OFFLINE=true"
echo "BUILD_REPO_URL=''"
echo "CARDS=false"
echo "HOMEPAGE_BUTTON_GET_STARTED_LINK=basics/why-privacy-matters.html"
echo "HOMEPAGE_BUTTON_TOOLS_LINK=tools.html"
} >> "$GITHUB_ENV"
- name: Set Metadata for Translations
if: inputs.lang != 'en'
run: |
{
echo "BUILD_ABBREVIATIONS=includes/abbreviations.${{ inputs.lang }}.txt"
echo "BUILD_DOCS_DIR=i18n/${{ inputs.lang }}"
echo "BUILD_EDIT_URI_TEMPLATE=https://github.com/privacyguides/i18n/blob/main/i18n/${{ inputs.lang }}/{path}?plain=1"
echo "BUILD_SITE_DIR=site/${{ inputs.lang }}"
echo "BUILD_SITE_URL=https://privacyguides.org/${{ inputs.lang }}"
echo "BUILD_THEME_LANGUAGE=${{ inputs.lang }}"
} >> "$GITHUB_ENV"
- name: Set Metadata for Hebrew Translation
if: inputs.lang == 'he'
run: |
{
echo "BUILD_THEME_FONT_CODE=Cousine"
echo "BUILD_THEME_FONT_TEXT=Open Sans"
echo "TRANSLATION_STYLESHEET=assets/stylesheets/lang-${{ inputs.lang }}.css?v=20240410"
} >> "$GITHUB_ENV"
- name: Set Metadata for Russian Translation
if: inputs.lang == 'ru'
run: |
{
echo "TRANSLATION_STYLESHEET=assets/stylesheets/lang-${{ inputs.lang }}.css?v=20240410"
} >> "$GITHUB_ENV"
- name: Set Metadata for Chinese (Traditional) Translation
if: inputs.lang == 'zh-Hant'
run: |
{
echo "BUILD_THEME_FONT_CODE=Noto Sans TC"
echo "BUILD_THEME_FONT_TEXT=Noto Sans TC"
echo "TRANSLATION_STYLESHEET=assets/stylesheets/lang-${{ inputs.lang }}.css?v=20240410"
echo "EXTRA_FLAGS=""$EXTRA_FLAGS" --offline""
} >> "$GITHUB_ENV"
- name: Download Repository
Expand Down Expand Up @@ -189,24 +147,10 @@ jobs:
pip install mkdocs-material
sudo apt install pngquant
- name: Set Translated String Environment Variables
uses: falti/[email protected]
with:
path: includes/strings.${{ inputs.lang }}.env
export-variables: true
keys-case: bypass

- name: Build Website
if: inputs.privileged
run: |
pipenv run mkdocs build --config-file mkdocs-production.yml
pipenv run mkdocs --version
- name: Build Website (Unprivileged)
if: ${{ !inputs.privileged }}
run: |
mkdocs build
mkdocs --version
eval ./run.sh --build "$EXTRA_FLAGS"
- name: Package Website
run: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ node_modules
# Python
.venv
.env
.mkdocs-insiders-*
16 changes: 16 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Daniel Gray <[email protected]> <[email protected]>
Daniel Gray <[email protected]> <[email protected]>
Daniel Gray <[email protected]> <[email protected]>
Daniel Gray <[email protected]>
Jonah Aragon <[email protected]> <[email protected]>
Jonah Aragon <[email protected]> <[email protected]>
Jonah Aragon <[email protected]> <[email protected]>
mfwmyfacewhen <[email protected]> <[email protected]>
mbananasynergy <[email protected]> <>
mbananasynergy <[email protected]> <[email protected]>
rollsicecream <[email protected]> <[email protected]>
rollsicecream <[email protected]> <[email protected]>
Freddy <[email protected]> <[email protected]>
Freddy <[email protected]> <[email protected]>
Niek de Wilde <[email protected]> <[email protected]>
Niek de Wilde <[email protected]> <[email protected]>
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ RUN \
tini \
zlib-dev \
libffi-dev \
musl-dev
musl-dev \
bash

# Copy virtual env from python-deps stage
COPY --from=python-deps /.venv /.venv
Expand All @@ -59,12 +60,13 @@ COPY theme theme
COPY includes includes
COPY *.yml .
COPY .cache/plugin/social/fonts .cache/plugin/social/fonts
COPY run.sh .

EXPOSE 8000

ENV MKDOCS_INHERIT mkdocs-production.yml

HEALTHCHECK NONE

ENTRYPOINT ["mkdocs"]
CMD ["serve", "--dev-addr=0.0.0.0:8000", "--config-file=mkdocs-production.yml"]
ENTRYPOINT ["./run.sh"]
CMD ["--cmd=mkdocs", "--insiders", "--cmd_flags=--dev-addr=0.0.0.0:8000"]
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ name = "pypi"
[packages]
mkdocs-material = {extras = ["imaging"], path = "./modules/mkdocs-material"}
mkdocs-git-revision-date-localized-plugin = "~=1.2"
mkdocs-git-committers-plugin-2 = "~=1.1"
mkdocs-git-authors-plugin = "~=0.8"
mkdocs-macros-plugin = "~=1.0"
jieba = "~=0.42"

Expand Down
Loading

0 comments on commit a0aa107

Please sign in to comment.