Skip to content

Merge pull request #183 from Aurorum-Studio/master #160

Merge pull request #183 from Aurorum-Studio/master

Merge pull request #183 from Aurorum-Studio/master #160

Workflow file for this run

# 推送检测新增或改动的外部插件版本并强制更新zip
name: "推送更新变动插件zip包"
on:
push:
branches:
- "master"
jobs:
md-check:
name: "检测文档是否有改动"
runs-on: "ubuntu-latest"
outputs:
diffUrl: ${{ steps.hash-name.outputs.url }}
hasMD: ${{ steps.grep-diff.outputs.md }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- id: hash-name
run: |
hash=`git log HEAD^ -1 | grep commit | awk '{print $2}'`
if [ -z `git log -1 --pretty=%B | grep "Merge branch"` ]
then
hash="master"
fi
diff=https://github.com/typecho-fans/plugins/commit/"$hash".diff
echo "::set-output name=url::$diff"
- id: grep-diff
run: |
if curl -s "${{ steps.hash-name.outputs.url }}" | grep "+++ b/TESTORE.md"
then
echo "::set-output name=md::1"
else
echo "::set-output name=md::"
fi
auto-update:
name: "更新有变动的插件zip"
runs-on: "ubuntu-latest"
needs: md-check
if: needs.md-check.outputs.hasMD
steps:
- uses: actions/checkout@v2
- name: "执行PHP脚本"
run: |
php AUTO-UPDATE.php ${{ secrets.GITHUB_TOKEN }} ${{ needs.md-check.outputs.diffUrl }}
- name: "提交更新文件"
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Upload zips of altered plugins in TESTORE.md"
- name: "上传操作记录"
uses: actions/upload-artifact@v2
with:
name: "updates-log"
path: /home/runner/work/plugins/TMP/updates.log
- name: "检测压缩文件"
id: match-zips
run: |
a2c=`find /home/runner/work/plugins/TMP/NEW -type f -name "[a-cA-C]*"`
echo "::set-output name=A2C::$a2c"
d2g=`find /home/runner/work/plugins/TMP/NEW -type f -name "[d-gD-G]*"`
echo "::set-output name=D2G::$d2g"
h2l=`find /home/runner/work/plugins/TMP/NEW -type f -name "[h-lH-L]*"`
echo "::set-output name=H2L::$h2l"
m2r=`find /home/runner/work/plugins/TMP/NEW -type f -name "[m-rM-R]*"`
echo "::set-output name=M2R::$m2r"
s2z=`find /home/runner/work/plugins/TMP/NEW -type f -name "[s-zS-Z]*"`
echo "::set-output name=S2Z::$s2z"
- name: "发布压缩包A-C"
uses: svenstaro/upload-release-action@v2
if: steps.match-zips.outputs.A2C
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: /home/runner/work/plugins/TMP/NEW/[a-cA-C]*
tag: "plugins-A_to_C"
overwrite: true
file_glob: true
- name: "发布压缩包D-G"
uses: svenstaro/upload-release-action@v2
if: steps.match-zips.outputs.D2G
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: /home/runner/work/plugins/TMP/NEW/[d-gD-G]*
tag: "plugins-D_to_G"
overwrite: true
file_glob: true
- name: "发布压缩包H-L"
uses: svenstaro/upload-release-action@v2
if: steps.match-zips.outputs.H2L
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: /home/runner/work/plugins/TMP/NEW/[h-lH-L]*
tag: "plugins-H_to_L"
overwrite: true
file_glob: true
- name: "发布压缩包M-R"
uses: svenstaro/upload-release-action@v2
if: steps.match-zips.outputs.M2R
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: /home/runner/work/plugins/TMP/NEW/[m-rM-R]*
tag: "plugins-M_to_R"
overwrite: true
file_glob: true
- name: "发布压缩包S-Z"
uses: svenstaro/upload-release-action@v2
if: steps.match-zips.outputs.S2Z
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: /home/runner/work/plugins/TMP/NEW/[s-zS-Z]*
tag: "plugins-S_to_Z"
overwrite: true
file_glob: true