CI #82669
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
# https://github.com/tsedlar | |
name: CI | |
on: | |
schedule: | |
# only run on a schedule, every 30 minutes | |
- cron: 0/30 * * * * | |
jobs: | |
update_gamepack: | |
runs-on: ubuntu-latest | |
container: | |
# image with AdoptOpenJDK 8 and git installed | |
image: mahabal/adoptopenjdk8-git:latest | |
steps: | |
- uses: actions/checkout@v1.2.0 | |
with: | |
ref: ${{ github.ref }} | |
- name: Deploy gamepack | |
run: | | |
mkdir -p jav_configs | |
mkdir -p world_list | |
cd gamepacks/ | |
curl -sL https://github.com/runetech/osrs-gamepack-downloader/releases/download/v1.3/osrs-gamepack-downloader.jar -o downloader.jar | |
REPO=$(echo ${{ github.repository }} | sed "s:.*/::") | |
BRANCH=$(echo ${{ github.ref }} | sed "s:.*/::") | |
git remote rm origin | |
git remote add origin "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" | |
git config user.name ${{ github.actor }} | |
git config user.email noreply@${{ github.actor }}.noreply.github.com | |
JAV_CONFIG=$(java -jar downloader.jar -p --dry-run) | |
OSRS_REV=$(java -jar downloader.jar -r) | |
rm -f downloader.jar | |
git add . | |
git diff-index --quiet HEAD || GIT_AUTHOR_DATE=\"$(date -ur osrs-${OSRS_REV}.jar)\" GIT_COMMITTER_DATE=\"$(date -ur osrs-${OSRS_REV}.jar)\" git commit -am "Add osrs-${OSRS_REV}.jar" && git push origin HEAD:${BRANCH} | |
cd ../jav_configs | |
echo "${JAV_CONFIG}" > jav_config_${OSRS_REV}.ws | |
git add . | |
git diff-index --quiet HEAD || git commit -am "Add jav_config.ws for osrs-${OSRS_REV}.jar" && git push origin HEAD:${BRANCH} | |
cd ../world_list | |
line=$(echo "${JAV_CONFIG}" | grep param_17); WORLD_LIST_URL=${line#"param_17="}; | |
curl -sL $WORLD_LIST_URL -o slr.ws | |
git add . | |
git diff-index --quiet HEAD || git commit -am "Update world list for for osrs-${OSRS_REV}.jar" && git push origin HEAD:${BRANCH} | |