mirror of
https://github.com/LamGC/quickly-conf-sshd.git
synced 2025-04-30 06:37:35 +00:00
52 lines
1.6 KiB
YAML
52 lines
1.6 KiB
YAML
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:
|
||
# 此处为ssh私钥的值,公钥放在Settings-Deploy keys-新建秘钥-填写进去
|
||
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:
|
||
# 要替换的个人访问地址,例如:ssh.lamgc.me
|
||
REPLACEMENT_VALUE: ${{ secrets.REPLACEMENT_VALUE }}
|
||
# Github用户名
|
||
GIT_USERNAME: ${{ secrets.GIT_USERNAME }}
|
||
# Github邮箱
|
||
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
|