update python command line #72
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
# Workflow for building and deploying a GitSite repo to GitHub Pages | |
name: Build liaoxuefeng.com | |
on: | |
# Runs on pushes targeting the default branch | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
# Build job | |
build: | |
permissions: | |
contents: write | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Setup Env | |
run: | | |
echo "RELEASE_AT=`echo ${{ github.event.head_commit.timestamp }} | sed 's/[:+]/-/g'`" >> "$GITHUB_ENV" | |
echo "SHORT_SHA=`echo ${{ github.sha }} | cut -c1-7`" >> "$GITHUB_ENV" | |
- name: Print Env | |
run: | | |
echo ${{ env.RELEASE_AT }} | |
echo ${{ env.SHORT_SHA }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install GitSite | |
run: | |
npm install gitsite-cli -g | |
- name: Build with GitSite | |
run: | |
# set output dir to '_site' for pages jobs: | |
gitsite-cli build -o _site | |
- name: Configure Pages | |
uses: actions/configure-pages@v5 | |
- name: Upload Pages Artifact | |
uses: actions/upload-pages-artifact@v3 | |
- name: Zip Generated Site | |
run: | |
cd _site && zip -r ../site.zip * && cd .. | |
- name: Release Zip | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: site.zip | |
tag: ${{ github.ref }}.${{ github.sha }} | |
release_name: site-source.${{ env.SHORT_SHA }} | |
body: Site source code including HTML, styles, scripts, images, etc. | |
overwrite: true | |
- name: Sync To Aliyun | |
uses: michaelliao/sync-s3-compatible-action@v2 | |
env: | |
SYNC_OPT_UNUSED: delete | |
SYNC_TYPE: aliyun | |
SYNC_REGION: cn-hangzhou | |
SYNC_BUCKET: ${{ secrets.OSS_BUCKET }} | |
SYNC_ACCESS_ID: ${{ secrets.OSS_ACCESS_ID }} | |
SYNC_ACCESS_SECRET: ${{ secrets.OSS_ACCESS_SECRET }} | |
- name: Sync To QCloud | |
uses: michaelliao/sync-s3-compatible-action@v2 | |
env: | |
SYNC_OPT_UNUSED: delete | |
SYNC_TYPE: qcloud | |
SYNC_REGION: ap-shanghai | |
SYNC_BUCKET: ${{ secrets.COS_BUCKET }} | |
SYNC_ACCESS_ID: ${{ secrets.COS_ACCESS_ID }} | |
SYNC_ACCESS_SECRET: ${{ secrets.COS_ACCESS_SECRET }} | |
- name: Sync To Baidu Cloud | |
uses: michaelliao/sync-s3-compatible-action@v2 | |
env: | |
SYNC_OPT_UNUSED: delete | |
SYNC_TYPE: baidu | |
SYNC_REGION: su | |
SYNC_BUCKET: ${{ secrets.BOS_BUCKET }} | |
SYNC_ACCESS_ID: ${{ secrets.BOS_ACCESS_ID }} | |
SYNC_ACCESS_SECRET: ${{ secrets.BOS_ACCESS_SECRET }} | |
# Deployment job | |
deploy: | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
uses: actions/deploy-pages@v4 |