Skip to content

update

update #116

Workflow file for this run

name: push to gitee
on:
push:
jobs:
push-to-gitee:
if: ${{ (github.repository_owner == 'jingjingxyk') && (github.repository == 'jingjingxyk/swoole-cli') }}
runs-on: ubuntu-latest
steps:
- name: install deps
run: |
sudo apt install openssh-client
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Prepare Secret Key
env:
PUSH_TO_GITEE_SECRET_KEY: ${{ secrets.PUSH_TO_GITEE_SECRET_KEY }}
run: |
mkdir -p ~/.ssh/
printf "%s\n" "$PUSH_TO_GITEE_SECRET_KEY" > ~/.ssh/swoole-cli-github-push-to-gitee-key
chmod 0400 ~/.ssh/swoole-cli-github-push-to-gitee-key
cat > ~/.ssh/config <<'EOF'
Host gitee.com
Hostname gitee.com
Port 22
PreferredAuthentications publickey
StrictHostKeyChecking no
IdentityFile ~/.ssh/swoole-cli-github-push-to-gitee-key
EOF
ls -lh ~/.ssh/
- name: push to gitee
run: |
set -x
ssh -T [email protected]
git remote add gitee [email protected]:jingjingxyk/swoole-cli.git
git fetch --all
git branch | cat
exit 0
git ls-remote --heads origin
git ls-remote --tags origin
# git ls-remote --tags origin | awk '{ print $2 }' | sed 's/^refs\/tags\///' | xargs -I {} git push gitee {}:{}
# git ls-remote --heads origin | awk '{ print $2 }' | sed 's/^refs\/heads\///' | xargs -I {} git push gitee {}
# git push gitee --all --force
# git push -u -f gitee --all
# git push -u -f gitee --tags
# 求差集 (gitee 存在的分支,github 不存在分支,执行删除操作)
# 默认输出三列,第一列包含文件1独有的行,第二列包含文件2独有的行,第三列包含两个文件共有的行。列之间由制表符分隔‌
# GITEE_BRANCHS=$(git branch -r --list | grep -v -- '->' | grep 'gitee/' | sed 's/gitee\///' | xargs -I {} echo {} | sort)
# GITHUB_BRANCHS=$(git branch -r --list | grep -v -- '->' | grep 'origin/' | sed 's/origin\///' | xargs -I {} echo {} | sort)
# comm <(echo $GITEE_BRANCHS) <(echo $GITHUB_BRANCHS) | awk -F "\t" '{ print $1 }' | xargs -I {} echo {}
# comm <(echo $GITEE_BRANCHS) <(echo $GITHUB_BRANCHS) | awk -F "\t" '{ print $1 }' | xargs -I {} echo {} | xargs -I {} git push -d gitee {}:{}