Files
SkyAutoPlayerScript/.github/workflows/syncToGitee.yml
2021-04-26 20:05:06 +08:00

46 lines
1.7 KiB
YAML

name: Auto update commit and sync to gitee
on: [ push, delete, create ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
if: github.actor != 'github-actions[bot]'
with:
persist-credentials: true
- name: Update commit hash to gitVersion
if: github.actor != 'github-actions[bot]'
run: |
git show -s --format=%H | awk 'NR == 1 {p = $0} NR > 1 {print p; p = $0} END{printf p}' > gitVersion
- name: Push commit
uses: EndBug/add-and-commit@v7.1.2
if: github.actor != 'github-actions[bot]'
with:
add: gitVersion
author_name: github-actions[bot]
author_email: 41898282+github-actions[bot]@users.noreply.github.com
message: Update git tree hash
push: true
- name: Sync to mirror ftp server
uses: kevinpainchaud/simple-ftp-deploy-action@v1.2.1
with:
ftp_host: ${{ secrets.FTP_MIRROR_DESTINATION }}
ftp_username: ${{ secrets.FTP_MIRROR_USERNAME }}
ftp_password: ${{ secrets.FTP_MIRROR_SECRET }}
local_source_dir: "./"
dist_target_dir: "./"
delete: false
only_newer: true
exclude: "'^\\.git' '\\.md$' '^sources/' 'gitVersion'"
- name: Sync to Gitee repo
uses: wearerequired/git-mirror-action@master
if: github.actor != 'github-actions[bot]'
env:
SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }}
with:
source-repo: git@github.com:StageGuard/SkyAutoPlayerScript.git
destination-repo: git@gitee.com:stageguard/SkyAutoPlayerScript.git