linux-publish_techblog-main_web_site #5
This file contains hidden or 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: "linux-publish_techblog-main_web_site" | |
on: | |
# push: | |
# branches: | |
# - master | |
# paths-ignore: | |
# # - .github/workflows/pub_web.yml | |
# - .gitignore | |
# - README.md | |
# - LICENSE | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow one concurrent deployment | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
build-docs: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
# - name: Checkout | |
# uses: actions/checkout@v4 | |
# with: | |
# fetch-depth: 1 | |
# submodules: true | |
# Checkout other repo | |
- name: Checkout other repo | |
uses: actions/checkout@v4 | |
with: | |
repository: linjonh/TechBlog | |
fetch-depth: 1 | |
path: TechBlog | |
- name: List checked out files | |
run: ls -alh TechBlog || echo "TechBlog not found" | |
#build | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.4.2' # 替换为你项目实际使用的版本 | |
bundler-cache: true | |
# Install ruby dependencies | |
- name: Install dependencies | |
run: | | |
pwd | |
ls -lh | |
cd TechBlog | |
gem install bundler | |
bundle install --jobs 4 --retry 3 | |
- run: bundle exec jekyll build -d "_site" --trace | |
env: | |
JEKYLL_ENV: production | |
#Setup pages | |
- name: Setup Pages | |
id: pages | |
uses: actions/configure-pages@v4 | |
# Upload the site artifact | |
- name: Upload site artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: "TechBlog/_site" | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build-docs | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |