mirror of
https://github.com/privacyguides/privacyguides.org.git
synced 2024-10-01 01:35:57 -04:00
136 lines
4.4 KiB
YAML
136 lines
4.4 KiB
YAML
# Copyright (c) 2024 Jonah Aragon <jonah@triplebit.net>
|
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
# of this software and associated documentation files (the "Software"), to
|
|
# deal in the Software without restriction, including without limitation the
|
|
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
# sell copies of the Software, and to permit persons to whom the Software is
|
|
# furnished to do so, subject to the following conditions:
|
|
|
|
# The above copyright notice and this permission notice shall be included in
|
|
# all copies or substantial portions of the Software.
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
# IN THE SOFTWARE.
|
|
|
|
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'
|
|
|
|
- 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:
|
|
python-version: '3.8'
|
|
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
|
|
|
|
- if: inputs.lang != 'en'
|
|
uses: falti/dotenv-action@v1.1
|
|
with:
|
|
path: includes/strings.${{ inputs.lang }}.env
|
|
export-variables: true
|
|
|
|
- env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
CONTEXT: ${{ inputs.context }}
|
|
PRODUCTION: true
|
|
run: |
|
|
pipenv run mkdocs build --config-file config/mkdocs.${{ inputs.lang }}.yml
|
|
cp -r static/* site/
|
|
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
|