AutoUpdate #7696
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: AutoUpdate | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: 0 0/2 * * * | |
env: | |
DepotDownloader_VERSION: '5b6315c8cad36395ea4a8172cca8b4706b7ddac9' | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.result.outputs.version }} | |
need_update: ${{ steps.result.outputs.need_update }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: "zxcvbnm3057/steamfetch-action@main" | |
with: | |
username: "${{ secrets.STEAM_USER }}" | |
password: "${{ secrets.STEAM_PASS }}" | |
dir: "${{ github.workspace }}/temp/" | |
os: "windows" | |
app: 322330 | |
osarch: 64 | |
files: "version.txt" | |
depotdownloader-version: ${{ env.DepotDownloader_VERSION }} | |
- name: Check need update or not | |
id: result | |
run: | | |
version=$(cat ${{ github.workspace }}/temp/version.txt | grep -o [0-9]*) | |
if [ "$(git describe --abbrev=0)" != "$version" ]; then | |
echo "need_update=True" >> $GITHUB_OUTPUT | |
echo "version=$version" >> $GITHUB_OUTPUT | |
fi | |
update: | |
runs-on: ubuntu-latest | |
needs: check | |
if: ${{ needs.check.outputs.need_update }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
path: temp/scripts | |
- name: Get files | |
uses: "zxcvbnm3057/steamfetch-action@main" | |
with: | |
username: "${{ secrets.STEAM_USER }}" | |
password: "${{ secrets.STEAM_PASS }}" | |
dir: "${{ github.workspace }}/temp/" | |
os: "windows" | |
app: 322330 | |
osarch: 64 | |
files: | | |
data/databundles/scripts.zip | |
depotdownloader-version: ${{ env.DepotDownloader_VERSION }} | |
- name: unzip | |
run: | | |
shopt -s extglob | |
cd ${{ github.workspace }}/temp/scripts | |
rm -rf !(.git/|.github/) | |
unzip -qd ${{ github.workspace }}/temp ${{ github.workspace }}/temp/data/databundles/scripts.zip | |
- name: push | |
run: | | |
cd ${{ github.workspace }}/temp/scripts | |
git add -A | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git commit -m ${{ needs.check.outputs.version }} | |
git tag ${{ needs.check.outputs.version }} -m $(git rev-parse HEAD) $(git rev-parse HEAD) | |
git push --follow-tags |