Release #6955
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: Release | |
on: | |
schedule: | |
- cron: "0 * * * *" | |
push: | |
branches: | |
- master | |
jobs: | |
check-update: | |
name: 检查微信读书核心js是否有更新 | |
runs-on: ubuntu-latest | |
if: github.repository == 'jooooock/wrx' | |
outputs: | |
needUpgrade: ${{ steps.step3.outputs.exists }} | |
steps: | |
- name: 拉取代码 | |
uses: actions/checkout@v4 | |
- name: 安装依赖 | |
run: yarn | |
- name: 检查微信读书是否更新 | |
id: step3 | |
run: | | |
node ./scripts/weread/check-update.js | |
test -e ./scripts/weread/tmp/url && echo "exists=true" >> "$GITHUB_OUTPUT" || echo "exists=false" >> "$GITHUB_OUTPUT" | |
build: | |
name: 打包发布 | |
runs-on: ubuntu-latest | |
needs: check-update | |
if: needs.check-update.outputs.needUpgrade == 'true' | |
steps: | |
- name: 拉取代码 | |
uses: actions/checkout@v4 | |
- name: 安装依赖 | |
run: yarn | |
- name: 执行构建 | |
id: build | |
run: | | |
node ./scripts/weread/check-update.js | |
node ./scripts/weread/patch.js | |
node ./scripts/weread/build.js | |
echo "version=v$(jq -r .version latest.json)" >> "$GITHUB_OUTPUT" | |
- name: 输出构建结果 | |
run: | | |
echo "build result: ${{ toJSON(steps.build.outputs) }}" | |
- name: 提交代码 | |
run: | | |
git config --local user.name bot | |
git config --local user.email bot@github.com | |
git add . | |
git commit -m "release $(echo $version)" | |
git tag $(echo $version) | |
git pull | |
git push origin master | |
git push --tags | |
- name: 发布 Release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "releases/wrx-${{ steps.build.outputs.version }}.zip" | |
tag: "${{ steps.build.outputs.version }}" |