feat(route): add 西南交通大学计算机学院本科生教育 (#16810) #3227
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: Build assets | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
paths: | |
- 'lib/**/*.ts' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: Build assets | |
timeout-minutes: 5 | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
- name: Use Node.js Active LTS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
cache: 'pnpm' | |
- name: Install dependencies (yarn) | |
run: pnpm i | |
- name: Build assets | |
run: pnpm build | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./assets | |
user_name: 'github-actions[bot]' | |
user_email: '41898282+github-actions[bot]@users.noreply.github.com' | |
# prevent deleting build/test-full-routes.json which will break build:docs | |
keep_files: true | |
- name: Build docs | |
run: pnpm build:docs | |
- id: check-env | |
env: | |
DOCS_API_TOKEN: ${{ secrets.DOCS_API_TOKEN }} | |
if: ${{ env.DOCS_API_TOKEN != '' }} | |
run: echo "defined=true" >> $GITHUB_OUTPUT | |
- name: Checkout docs | |
uses: actions/checkout@v4 | |
if: steps.check-env.outputs.defined == 'true' | |
with: | |
repository: 'RSSNext/rsshub-docs' | |
token: ${{ secrets.DOCS_API_TOKEN }} | |
path: rsshub-docs | |
- name: Update docs | |
if: steps.check-env.outputs.defined == 'true' | |
run: | | |
cp -r ./assets/build/docs/en/* ./rsshub-docs/src/routes | |
cp -r ./assets/build/docs/zh/* ./rsshub-docs/src/zh/routes | |
cp ./lib/types.ts ./rsshub-docs/.vitepress/theme/types.ts | |
cp ./scripts/workflow/data.ts ./rsshub-docs/.vitepress/config/data.ts | |
- name: Commit docs | |
if: steps.check-env.outputs.defined == 'true' | |
run: | | |
cd rsshub-docs | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git status | |
git diff-index --quiet HEAD || (git commit -m "chore: auto build https://github.com/$GITHUB_REPOSITORY/commit/$GITHUB_SHA" -a --no-verify && git push "https://${GITHUB_ACTOR}:${{ secrets.DOCS_API_TOKEN }}@github.com/RSSNext/rsshub-docs.git" HEAD:main) |