Update deploy workflow #11
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 and Deploy Jekyll to GitHub Pages | |
on: | |
push: | |
branches: | |
- web-deployment # 更改为您的主分支名称,如果不是 master | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Checkout Notes.md and Notes.assets from master | |
uses: actions/checkout@v2 | |
with: | |
repository: routhleck/BrainPy-course-notes | |
ref: master | |
path: master_content | |
- name: Process Notes.md using markdown_process.py | |
run: python3 markdown_process.py -i master_content/Notes.md -o _posts/2023-08-27-BrainPy-course-notes.md | |
- name: Move Notes.assets to assets/images/ | |
run: mv -f master_content/Notes.assets assets/images/ | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.5 # 使用与您的 Jekyll 网站相匹配的 Ruby 版本 | |
- name: Install dependencies | |
run: | | |
gem install bundler:1.17.1 | |
bundle install --jobs 4 --retry 3 | |
- name: Build Jekyll site | |
run: bundle exec jekyll build | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: jekyll-site | |
path: ./_site | |
# Deployment job | |
deploy: | |
environment: | |
name: github-pages | |
url: https://routhleck.github.io/BrainPy-course-notes/ | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: jekyll-site | |
path: ./_site | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.WEB_DEPLOYMENT }} | |
publish_dir: ./_site |