Update contents #164
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
name: BuildDocs | |
on: | |
push: | |
branches: | |
- "main" | |
- "dev_docs" | |
paths: | |
- ".github/workflows/build_docs.yml" | |
- "celery_task/**" | |
- "docs_dev/**" | |
- "main.py" | |
- "models/**" | |
- "module/**" | |
- "structs/**" | |
- "view/**" | |
workflow_dispatch: | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: ["ubuntu-20.04"] | |
python-version: ["3.11"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Update libs | |
run: sudo apt-get update | |
- name: Install memcached libs | |
run: sudo apt-get install ca-certificates libmemcached-tools | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache Poetry venv | |
uses: actions/cache@v4 | |
with: | |
path: ./.venv | |
key: poetry-venv-${{ matrix.python-version }}${{ hashFiles('**/poetry.lock') }} | |
- name: Cache Poetry local | |
uses: actions/cache@v4 | |
with: | |
path: ~/.local/share/pypoetry | |
key: poetry-local-${{ matrix.python-version }}${{ hashFiles('**/poetry.lock') }} | |
- name: Cache Poetry cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pypoetry | |
key: poetry-cache-${{ matrix.python-version }}${{ hashFiles('**/poetry.lock') }} | |
- name: Install mkdocs-material social dependencies | |
run: sudo apt-get install libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev | |
- name: Install and configure Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: 1.8.2 | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
installer-parallel: true | |
- name: Install dependencies | |
run: poetry install | |
- name: Create setting.py | |
run: mv setting_sample.py setting.py | |
- name: Create docs .cache folder | |
run: cd docs_dev; mkdir -p .cache/plugin/social/fonts/Noto\ Sans\ TC | |
- name: Load Noto Sans TC font | |
run: cd docs_dev/.cache/plugin/social/fonts/Noto\ Sans\ TC; wget https://volunteer.coscup.org/doc/NotoSansTC-Bold.ttf -O Bold.ttf; | |
- name: Load Iansui094 font | |
run: cd docs_dev/.cache/plugin/social/fonts/Noto\ Sans\ TC; wget https://volunteer.coscup.org/doc/Iansui094-Regular.ttf -O Regular.ttf; | |
- name: manual install mkdocs-material | |
run: git clone https://github.com/squidfunk/mkdocs-material.git; poetry add ./mkdocs-material/; | |
- name: Build Docs | |
env: | |
PYTHONPATH: "../" | |
run: cd docs_dev; poetry run mkdocs -v build -s; | |
- name: Clean the all files | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.DOC_S3_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.DOC_S3_KEY }} | |
run: poetry run aws s3 rm s3://coscup-volunteer-docs --recursive | |
- name: Upload to S3 | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.DOC_S3_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.DOC_S3_KEY }} | |
run: cd docs_dev; poetry run aws s3 sync ./site s3://coscup-volunteer-docs/ --acl public-read |