mirror of
https://github.com/privacyguides/privacyguides.org
synced 2024-12-11 04:13:33 +01:00
ce7896c07f
Signed-off-by: Daniel Gray <dngray@privacyguides.org>
115 lines
3.3 KiB
YAML
115 lines
3.3 KiB
YAML
name: Build Website
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
ref:
|
|
required: true
|
|
type: string
|
|
repo:
|
|
required: true
|
|
type: string
|
|
lang:
|
|
type: string
|
|
default: en
|
|
context:
|
|
type: string
|
|
default: deploy-preview
|
|
continue-on-error:
|
|
type: boolean
|
|
default: true
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
continue-on-error: ${{ inputs.continue-on-error }}
|
|
permissions:
|
|
contents: read
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
repository: ${{ inputs.repo }}
|
|
ref: ${{ inputs.ref }}
|
|
persist-credentials: "false"
|
|
fetch-depth: 0
|
|
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
pattern: repo-*
|
|
path: modules
|
|
|
|
- run: |
|
|
rmdir modules/mkdocs-material
|
|
mv modules/repo-mkdocs-material-insiders modules/mkdocs-material
|
|
rmdir theme/assets/brand
|
|
mv modules/repo-brand theme/assets/brand
|
|
|
|
- if: inputs.lang != 'en'
|
|
run: |
|
|
cp -rl modules/repo-i18n/i18n .
|
|
cp -rl modules/repo-i18n/includes .
|
|
cp -rl modules/repo-i18n/theme .
|
|
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
cache: "pipenv"
|
|
|
|
- uses: actions/cache/restore@v4.0.2
|
|
with:
|
|
key: site-cache-${{ inputs.repo }}-${{ inputs.ref }}-${{ hashfiles('.cache/**') }}
|
|
path: .cache
|
|
restore-keys: |
|
|
site-cache-${{ inputs.repo }}-${{ inputs.ref }}-
|
|
site-cache-${{ inputs.repo }}-
|
|
|
|
- uses: actions/cache/restore@v4.0.2
|
|
with:
|
|
key: card-cache-${{ inputs.repo }}-${{ inputs.lang }}-${{ inputs.ref }}-${{ hashfiles('config/.cache/plugin/social/manifest.json') }}
|
|
path: |
|
|
config/.cache/plugin/social/manifest.json
|
|
config/.cache/plugin/social/assets
|
|
restore-keys: |
|
|
card-cache-${{ inputs.repo }}-${{ inputs.lang }}-${{ inputs.ref }}-
|
|
card-cache-${{ inputs.repo }}-${{ inputs.lang }}-
|
|
|
|
- run: |
|
|
pip install pipenv
|
|
pipenv install
|
|
sudo apt install pngquant
|
|
|
|
- uses: falti/dotenv-action@v1.1
|
|
with:
|
|
path: includes/strings.${{ inputs.lang }}.env
|
|
export-variables: true
|
|
keys-case: bypass
|
|
|
|
- env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
CONTEXT: ${{ inputs.context }}
|
|
PRODUCTION: true
|
|
run: |
|
|
pipenv run mkdocs build --config-file config/mkdocs.${{ inputs.lang }}.yml
|
|
pipenv run mkdocs --version
|
|
tar -czvf site-build-${{ inputs.lang }}.tar.gz site
|
|
|
|
- uses: actions/cache/save@v4.0.2
|
|
with:
|
|
key: site-cache-${{ inputs.repo }}-${{ inputs.ref }}-${{ hashfiles('.cache/**') }}
|
|
path: .cache
|
|
|
|
- uses: actions/cache/save@v4.0.2
|
|
with:
|
|
key: card-cache-${{ inputs.repo }}-${{ inputs.lang }}-${{ inputs.ref }}-${{ hashfiles('config/.cache/plugin/social/manifest.json') }}
|
|
path: |
|
|
config/.cache/plugin/social/manifest.json
|
|
config/.cache/plugin/social/assets
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: site-build-${{ inputs.lang }}.tar.gz
|
|
path: site-build-${{ inputs.lang }}.tar.gz
|