From 954715dda002c2a039b740654535648c23c992d4 Mon Sep 17 00:00:00 2001 From: NANSIYV <39900381+nsv2051@users.noreply.github.com> Date: Tue, 24 Oct 2023 14:01:18 +0800 Subject: [PATCH] Create sed.yml --- .github/workflows/sed.yml | 47 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/sed.yml diff --git a/.github/workflows/sed.yml b/.github/workflows/sed.yml new file mode 100644 index 0000000..78dc6f8 --- /dev/null +++ b/.github/workflows/sed.yml @@ -0,0 +1,47 @@ +name: 更新个人访问地址1.0 + +on: + # schedule: + # - cron: "0 0 * * *" + workflow_dispatch: + +permissions: + contents: write + +jobs: + # 使用 actions/github-script 向 README 文件写入个人访问地址。 + check-updates: + timeout-minutes: 30 + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Deploy Private Key + env: + DEPLOY_KEY: ${{secrets.DEPLOY_KEY}} + run: | + mkdir -p ~/.ssh/ + echo "$DEPLOY_KEY"> ~/.ssh/id_ed25519 + chmod 700 ~/.ssh + chmod 600 ~/.ssh/id_ed25519 + ssh-keyscan github.com >> ~/.ssh/known_hosts + - name: Commit + run: | + sed -i "s/ssh.lamgc.me/$REPLACEMENT_VALUE/g" README.md + git config --global user.name "$GIT_USERNAME" + git config --global user.email "$GIT_EMAIL" + git add README.md + git commit -m "更新个人访问地址" + git push -u origin main + env: + REPLACEMENT_VALUE: ${{ secrets.REPLACEMENT_VALUE }} + GIT_USERNAME: ${{ secrets.GIT_USERNAME }} + GIT_EMAIL: ${{ secrets.GIT_EMAIL }} + - name: Commit changes + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: 更新个人访问地址 + commit_options: '--no-verify' + push_options: '--force' + file_pattern: LATEST_VERSION