Files
2024-12-21 04:46:09 +08:00

74 lines
2.9 KiB
YAML

name: sync
run-name:
on:
schedule:
- cron: '0 4 * * *'
issues:
types: [opened]
push:
branches: [pure-sr]
jobs:
build:
runs-on: steam-runner
steps:
- name: Clone repository
run: |
ls -lh
rm -rf azurlane-sr-reforged
git -c http.sslVerify=false clone https://${{ secrets.GITHUB_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 2131096629 +quit
./steamcmd.sh +login ${{ secrets.STEAM_USERNAME }} ${{ secrets.STEAM_PASSWORD }} +workshop_download_item 394360 2249768662 +quit
- name: clean src and copy to src
run: |
ls -lh
cd azurlane-sr-reforged
git checkout pure-sr
cp -r src ../
git checkout main
rm -rf src
ls -lh
cp -r /home/steam/Steam/steamapps/workshop/content/394360/2249768662 ./src
rm -rf azurlane-sr-reforged/src/history/units/*
rm -rf "azurlane-sr-reforged/src/history/countries/SIR - Siren.txt"
rm -rf "azurlane-sr-reforged/src/history/countries/SR1 - SirenM.txt"
rm -rf "azurlane-sr-reforged/src/history/countries/SR2 - SirenF.txt"
rm -rf "azurlane-sr-reforged/src/history/countries/SR3 - SirenY.txt"
rm -rf "azurlane-sr-reforged/src/localisation/simp_chinese/az_beijing_l_simp_chinese.yml"
cp -rf ../src/* ./src/
rm src/descriptor.mod
rm -rf src/.vscode
cp /home/steam/Steam/steamapps/workshop/content/394360/2131096629/descriptor.mod src/descriptor.mod
- name: pull mapfile
run: |
curl -X 'GET' -O https://${{ secrets.URI }}/azurlane-hoi4/az-map/releases/download/sairen/sairen-map.tar.gz -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}'
tar zxvf sairen-map.tar.gz
rm -rf azurlane-sr-reforged/src/history/states/*
cp -rf release/sairen/* azurlane-sr-reforged/src/history/states/
rm -rf release
rm sairen-map.tar.gz
- name: check diff
id: check_changes
run: |
ls -lh
cd azurlane-sr-reforged
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-sr-reforged
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.GITHUB_TOKEN }}@${{ secrets.URI }}/${{ github.repository }}.git