2022-08-20记

2022-08-20 04:36 Saturday4691min
CC BY 4.0(除特别声明和转载)

Actions修缮完成

发现在2022-08-15#^code的版本中的缓存效果并没有起效过,在搜集资料后将cache@v3,改为了ruby/setup-ruby@v1。在使用该action时,需注意云部署环境与GemFile的匹配,建议在相同环境下生成GemFileGemFile.lock,确定Ruby版本,以进行参数设定。后发现在jekyll-action@v2中仍有冗余部署操作如安装bundle、插件。遂硬着头皮看jekyll-action@v2源码,在jekyll-action/entrypoint.sh at master · helaili/jekyll-action · GitHub中发现一句bundle exec ${BUNDLE_ARGS} jekyll build觉得是必要,仅要且可行操作。遂试之。一看,Complete,可行。最终顺利为我的actions提速。
Imgur 满意

用于发布基于Jekyll的博客的Github actions,最终版本

name: Deploy GitHub Pages
on:
  push:
    branches:
      - main
jobs:
  gh-pages:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          persist-credentials: false
      - name: Setup Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: 3.0.2 # Not needed with a .ruby-version file
          bundler-cache: true # runs 'bundle install' and caches installed gems automatically
      - run: bundle exec ${BUNDLE_ARGS} jekyll build
      - name: Deploy to GitHub Pages
        uses: JamesIves/github-pages-deploy-action@v4.4.0
        with:
          token: ${{ secrets.ACCESS_TOKEN }} # github token
          repository-name: yaleiyale/yaleiyale.github.io # target repo
          branch: gh-pages
          folder: _site
          clean: true
          commit-message: Deploying to gh-pages from @ yaleiyale
BuyMeACola