Update sync_clone_scripts_master_to_git.yml

This commit is contained in:
lan-tianxiang
2021-04-14 18:40:22 +08:00
committed by GitHub
parent 0538436a8a
commit 037e1865ec

View File

@ -2,50 +2,28 @@ name: sync_clone_scripts_master_to_git
on: on:
workflow_dispatch: workflow_dispatch:
schedule: schedule:
- cron: '*/15 * * * *' - cron: '6 */4 * * *'
jobs: jobs:
sync: sync:
runs-on: ubuntu-18.04 runs-on: ubuntu-latest
if: github.repository == 'lan-tianxiang/clone_scripts'
timeout-minutes: 3 timeout-minutes: 3
steps: steps:
- name: Init Build Dependencies - name: Sync to Gitee
env: uses: wearerequired/git-mirror-action@master
DEBIAN_FRONTEND: noninteractive env:
run: | # 注意在 Settings->Secrets 配置 GITEE_RSA_PRIVATE_KEY
sudo -E rm -rf /etc/apt/sources.list.d SSH_PRIVATE_KEY: ${{ secrets.RSA_PRIVATE_KEY }}
sudo -E apt-get update -y with:
sudo -E apt-get install -y build-essential git git-core curl wget # 注意替换为你的 GitHub 源仓库地址
sudo -E apt-get clean -y source-repo: git@github.com:lan-tianxiang/clone_scripts.git
git config --global user.name 'lxk0301' && git config --global user.email 'lxk0301@gitee.com' # 注意替换为你的 Gitee 目标仓库地址
- name: Prepare Key destination-repo: git@gitee.com:highdimen/clone_scripts.git
run: |
mkdir -p ~/.ssh - name: Delete Workflow Runs
echo -e "${{ secrets.RSA_PRIVATE_KEY }}" > ~/.ssh/id_rsa uses: Mattraks/delete-workflow-runs@main
chmod 600 ~/.ssh/id_rsa with:
ssh-keyscan github.com > ~/.ssh/known_hosts token: ${{ github.token }}
- name: Clone Master repository: ${{ github.repository }}
run: | retain_days: 1
git clone -b master git@github.com:lan-tianxiang/clone_scripts.git master keep_minimum_runs: 0
- name: Prepare Key
run: |
mkdir -p ~/.ssh
echo -e "${{ secrets.RSA_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan gitee.com > ~/.ssh/known_hosts
- name: push Master
run: |
cd master
perl -i -pe "s|url \= git\@github.com:lan-tianxiang\/clone_scripts.git|url \= git\@gitee.com:highdimen\/clone_scripts.git|g" .git/config
cat .git/config
echo $(date) > time
git add .
git commit -m "update"
git push -f
- name: Delete Workflow Runs
uses: Mattraks/delete-workflow-runs@main
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: 1
keep_minimum_runs: 0