Skip to content

Commit

Permalink
Create autoupdate.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
EmperorPinguin committed Aug 18, 2024
1 parent a03e85f commit 30ead69
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/autoupdate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Autoupdate

on:
# Triggers the workflow on push or pull request events but only for the "master" branch
push:
branches: [ "master" ]
schedule:
- cron: '30 2 * * *' # Run once per day

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
unciv-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: oxipng image compression # This needs to be before the Unciv run since that packs images
run: |
oxipng_url=$(curl -s https://api.github.com/repos/shssoichiro/oxipng/releases/latest | grep -o "http.*x86_64-unknown-linux-gnu.tar.gz")
wget -O oxipng.tar.gz $oxipng_url
tar -xvzf oxipng.tar.gz
rm oxipng.tar.gz
# We're left with a folder named like "oxipng-9.1.2-x86_64-unknown-linux-gnu" which contains the actual executable
# So we find the file, run it on all png files in "Images" folders, and then delete the folder so it won't be a git diff
oxipng_file=$(find oxipng* | grep "/oxipng")
find Images* -type f -regex ".*png" | xargs -d '\n' $oxipng_file --opt max --strip all --alpha
rm -rf $(ls -1 | grep oxipng)
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17

# Runs a set of commands using the runners shell
- name: Autoupdate
continue-on-error: true # We want to autoupdate even if there are errors
run: |
unciv_url=$(curl -s https://api.github.com/repos/yairm210/unciv/releases/latest | grep -o "http.*Unciv.jar")
wget -q -O Unciv.jar $unciv_url
java -jar Unciv.jar mod-ci
- name: Remove Unciv executable
run: rm Unciv.jar

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
commit-message: Autoupdate

0 comments on commit 30ead69

Please sign in to comment.