sync #126
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: BuildIndex | |
# 控制工作流何时运行 | |
on: | |
push: # 整个流程在 main 分支发生push事件时触发。 | |
branches: [ master ] | |
# pull_request: | |
# branches: [ main ] | |
# 允许您从Actions选项卡手动运行此工作流 | |
workflow_dispatch: | |
# 一个工作流运行由一个或多个作业组成,这些作业可以顺序地或并行地运行 | |
jobs: | |
# 此工作流包含一个作业 | |
buildtree: | |
# 作业将在其上运行的运行器类型 | |
runs-on: ubuntu-latest | |
# 步骤表示将作为作业的一部分执行的任务序列 | |
steps: | |
# 签出 $GITHUB_WORKSPACE 下的存储库,以便作业可以访问它 | |
- name: Checkout | |
uses: actions/checkout@v2 | |
# 使用 shell 运行命令 | |
- name: UpdateSubmodule | |
run: git submodule update --remote | |
working-directory: ./ | |
- name: BuildTree | |
run: tree -n -f > tree.txt | |
working-directory: ./ | |
- name: ImportGPG | |
uses: crazy-max/ghaction-import-gpg@v6 | |
with: | |
git_config_global: true | |
gpg_private_key: ${{ secrets.PGP_PRIVATE_KEY_BLOCK }} | |
passphrase: ${{ secrets.PGP_PRIVATE_KEY_PASSPHRASE }} | |
fingerprint: "9A9121AFE0002AB746FB0B1079A9CCDDB8C957F3" | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
trust_level: 5 | |
git_committer_name: "KagurazakaYashi" | |
git_committer_email: "yashi@uuu.moe" | |
- name: Push | |
run: | | |
dt=`date +%Y-%m-%d-%H-%M-%S-%s` | |
echo "$dt 准备提交目录:" | |
ds=`git diff --stat` | |
echo $ds | |
if [[ -n $ds ]] | |
then | |
gpg -K | |
h1=`git show -s --format='自动更新:为 %H 创建目录文件'` | |
h2=`git show -s --format='由 %an(%al) 提交于 %ai'` | |
echo $h1 | |
echo $h2 | |
echo "添加..." | |
git add . | |
git config --global user.name "神楽坂雅絵[bot]" | |
git config --global user.email "masae@uuu.moe" | |
#git config --global user.signingkey "9A9121AFE0002AB746FB0B1079A9CCDDB8C957F3" | |
#git config --global commit.gpgsign true | |
echo "签名..." | |
git commit -S -m "$h1" -m "$h2" | |
echo "令牌..." | |
git remote set-url origin "https://x-access-token:${{ secrets.ACCESS_TOKEN }}@github.com/${{ github.repository }}" | |
echo "推送..." | |
git push #master | |
echo "提交完毕。" | |
else | |
echo "没有变更需要提交,跳过。" | |
fi | |
working-directory: ./ |