Deploy Pages #30
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: Deploy Pages | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: '0 6 */2 * *' | |
jobs: | |
deploy-pages: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install poetry | |
run: pipx install --python python poetry==1.5.1 | |
- name: Checkout git repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
architecture: 'x64' | |
cache: 'poetry' | |
- name: Install Python dependencies | |
run: poetry install -n | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
architecture: 'x64' | |
cache: 'npm' | |
- name: Install npm packages | |
# yamllint disable-line rule:line-length | |
run: npm install --no-fund -f -g svgo html-minifier postcss cssnano postcss-svgo postcss-cli uglify-js | |
- name: Install additional Ubuntu packages | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: rustc pngquant libjpeg-turbo-progs | |
version: 'ubuntu' | |
- name: Install oxipng | |
uses: baptiste0928/cargo-install@v2 | |
with: | |
crate: oxipng | |
- name: Restore MkDocs cached files | |
uses: actions/cache@v3 | |
with: | |
path: .pub_min_cache | |
key: mkdocs-publisher-cache-${{ github.run_id }} | |
restore-keys: mkdocs-publisher-cache- | |
- name: Build mkdocs-publisher documentation | |
run: poetry run mkdocs build -c | |
- name: Commit static site to repository with GitHub Pages enabled | |
uses: cpina/github-action-push-to-another-repository@main | |
env: | |
API_TOKEN_GITHUB: ${{ secrets.DEPLOY_PAGES_TOKEN }} | |
with: | |
user-name: ${{ secrets.USER_NAME }} | |
user-email: ${{ secrets.USER_EMAIL }} | |
source-directory: docs | |
destination-github-username: ${{ secrets.USER_NAME }} | |
destination-repository-name: kb-publisher | |
target-branch: docs | |
- name: Save MkDocs files cache | |
uses: actions/cache/save@v3 | |
with: | |
path: .pub_min_cache | |
key: mkdocs-publisher-cache-${{ github.run_id }} |