添加 .gitea/workflows/sync.yml

This commit is contained in:
azw
2024-07-22 19:20:12 +08:00
parent 3070e7a343
commit 8d82499d33

51
.gitea/workflows/sync.yml Normal file
View File

@@ -0,0 +1,51 @@
name: sync
run-name:
on:
schedule:
- cron: '35 */4 * * *'
issues:
types: [opened]
jobs:
build:
runs-on: steam-runner
steps:
- name: Clone repository
run: |
ls -lh
rm -rf azurlane-tj
git -c http.sslVerify=false clone -b main https://${{ secrets.ACCESS_TOKEN }}@${{ secrets.URI }}/${{ github.repository }}.git
- name: sync currect file
run: |
cd /home/steam/steamcmd
ls -lh
./steamcmd.sh +login ${{ secrets.STEAM_USERNAME }} ${{ secrets.STEAM_PASSWORD }} +workshop_download_item 394360 2993772482 +quit
- name: clean src and copy to src
run: |
ls -lh
cd azurlane-tj
rm -rf src
ls -lh
cp -r /home/steam/Steam/steamapps/workshop/content/394360/2993772482 src
rm -rf src/.git
- name: check diff
id: check_changes
run: |
ls -lh
cd azurlane-tj
ls -lh
if [ -z "$(git status --porcelain)" ]; then
echo "::set-output name=has_changes::false"
else
echo "::set-output name=has_changes::true"
fi
- name: commit and push
if: ${{ steps.check_changes.outputs.has_changes == 'true' }}
run: |
ls -lh
cd azurlane-tj
ls -lh
git config --local user.email "actions[bot]@users.noreply.github.com"
git config --local user.name "actions[bot]"
git add .
git commit --allow-empty -m "$(date '+%Y-%m-%d %H:%M:%S')"
git -c http.sslVerify=false push https://${{ secrets.ACCESS_TOKEN }}@${{ secrets.URI }}/${{ github.repository }}.git