-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a03e85f
commit 30ead69
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
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
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 |