-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add initial workflow for building mkdocs on push
- Loading branch information
Showing
1 changed file
with
79 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: Build and deploy Mkdocs | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
pull_request_review: | ||
types: [edited, dismissed] | ||
|
||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
deployments: write | ||
|
||
steps: | ||
- name: Checkout 🛎️ | ||
uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false | ||
fetch-depth: '0' | ||
|
||
# setup python | ||
- name: Set up Python 3.13 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.13.* | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip setuptools | ||
python -m pip install -U pip wheel | ||
python -m pip install -r requirements.txt | ||
pip show mkdocs-material | ||
- name: mkdocs build | ||
run: mkdocs build -f mkdocs.yml --clean --verbose -d generated | ||
|
||
- name: Include _headers file | ||
run: cp _headers generated/_headers | ||
|
||
- name: Publish to Cloudflare Pages | ||
if: github.event_name != 'pull_request' | ||
uses: cloudflare/pages-action@1 | ||
with: | ||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | ||
accountId: ${{ secrets.CLOUDFLARE_ID }} | ||
projectName: aosus-translation | ||
directory: generated | ||
gitHubToken: ${{ secrets.GITHUB_TOKEN }} | ||
branch: main | ||
|
||
- name: Publish preview to Cloudflare Pages | ||
if: github.event_name == 'pull_request' | ||
uses: cloudflare/[email protected] | ||
with: | ||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | ||
accountId: ${{ secrets.CLOUDFLARE_ID }} | ||
projectName: aosus-translation | ||
directory: generated | ||
gitHubToken: ${{ secrets.GITHUB_TOKEN }} | ||
branch: ${{ github.ref.name }} | ||
|
||
- name: Cache pip files | ||
uses: actions/cache@v4 | ||
env: | ||
cache-name: pip-reg | ||
with: | ||
path: $HOME/.cache/pip | ||
key: pip-reg | ||
|
||
- name: Cache Mkdocs files | ||
uses: actions/cache@v4 | ||
with: | ||
key: ${{ github.ref }} | ||
path: .cache |