Publish docs via GitHub Pages #12
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: Publish docs via GitHub Pages | |
on: | |
workflow_dispatch: ## on button click | |
jobs: | |
build: | |
name: Deploy docs | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- | |
run: git show remotes/origin/gh-pages:index.yaml > docs/index.yaml | |
- | |
name: Deploy docs | |
#uses: mhausenblas/mkdocs-deploy-gh-pages@master | |
uses: sir5kong/mkdocs-deploy-gh-pages@master | |
# Or use mhausenblas/mkdocs-deploy-gh-pages@nomaterial to build without the mkdocs-material theme | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GOOGLE_ANALYTICS_KEY: ${{ vars.GOOGLE_ANALYTICS_KEY }} | |
oss-sync: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
# fetch-depth: 0 | |
ref: 'gh-pages' | |
- | |
name: Upload to OSS | |
if: ${{ vars.OSS_MIRROR_ENABLED == 'true' }} | |
shell: bash | |
env: | |
DL_URL_OSS: "https://gosspublic.alicdn.com/ossutil/1.7.1/ossutil64" | |
OSS_KEY_ID: "${{ secrets.OSS_KEY_ID }}" | |
OSS_KEY_SECRET: "${{ secrets.OSS_KEY_SECRET }}" | |
OSS_EP: "${{ vars.OSS_EP }}" | |
OSS_BUCKET: "${{ vars.PAGES_OSS_BUCKET }}" | |
MIRROR_HOST: "${{ vars.MIRROR_HOST }}" | |
run: | | |
export ALIOSS="${HOME}/bin/ossutil" | |
mkdir -p $(dirname $ALIOSS) | |
curl -o $ALIOSS -L $DL_URL_OSS | |
chmod a+rx $ALIOSS | |
$ALIOSS config -e $OSS_EP -i $OSS_KEY_ID -k $OSS_KEY_SECRET | |
repo_name="${GITHUB_REPOSITORY#*/}" | |
$ALIOSS cp -rf ./ "oss://${OSS_BUCKET}/${repo_name}/" |