不再进行换行符转换 #54
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: Sync To Gitee | |
on: | |
push: | |
branches: | |
- 'main' | |
env: | |
SSH_PRIVATE_KEY: "${{ secrets.SSH_PRIVATE_KEY }}" | |
GIT_CLONE: "${{ github.workspace }}/git_clone" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@main | |
with: | |
fetch-depth: 0 | |
- name: Install tools | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y ssh git | |
- name: Sync to Gitee | |
run: | | |
mkdir -p ~/.ssh | |
echo "${SSH_PRIVATE_KEY}" > ~/.ssh/id_rsa | |
sudo chmod 0600 ~/.ssh/id_rsa | |
sudo chmod 0777 /etc/ssh/ssh_config | |
sudo echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config | |
sudo chmod 0644 /etc/ssh/ssh_config | |
eval "$(ssh-agent -s)" | |
ssh-add ~/.ssh/id_rsa | |
mkdir -vp ${GIT_CLONE} | |
git clone --mirror "[email protected]:chase535/accurate_battery.git" ${GIT_CLONE} | |
cd ${GIT_CLONE} | |
git remote set-url --push origin "[email protected]:chase535/accurate_battery" | |
git fetch -p origin | |
git for-each-ref --format 'delete %(refname)' refs/pull | git update-ref --stdin | |
git push --mirror |