Check latest release version #70
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: Check latest release version | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- 'latest-version/wesnoth-devel-latest.txt' | |
schedule: | |
- cron: "0 6 * * *" | |
workflow_dispatch: | |
jobs: | |
check-latest-version: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.REPO_SCOPED_TOKEN }} | |
- name: Fetch ATOM Feed | |
uses: Promptly-Technologies-LLC/rss-fetch-action@ecefea274f0618de6d45353cf9b73355873e89db | |
with: | |
feed_url: 'https://sourceforge.net/p/wesnoth/activity/feed' | |
file_path: './feed.json' | |
- name: Extract latest relased development version | |
run: | | |
version="1.19." | |
prefix="wesnoth-" | |
suffix=".tar.bz2" | |
latestversion=$(jq --arg prefix "$prefix" --arg suffix "$suffix" --arg version "$version" -r '.entries | sort_by(.published) | reverse | map(select(.title | contains($prefix + $version) and endswith($suffix) )) | first? | .title | sub(".*" + $prefix; "") | sub($suffix; "")' feed.json) | |
if [[ "$latestversion" == "" ]]; then echo "no latest version found or error"; else printf '%s\n' "$latestversion" > latest-version/wesnoth-devel-latest.txt; fi | |
- name: Check for modified files | |
id: git-check | |
run: echo modified=$([ -z "`git status --porcelain`" ] && echo "false" || echo "true") >> $GITHUB_OUTPUT | |
- name: Commit latest release version | |
if: steps.git-check.outputs.modified == 'true' | |
run: | | |
git config --global user.name 'Andrea Tarocchi' | |
git config --global user.email '[email protected]' | |
git commit -am "New release version found and updated." | |
git push | |
- uses: gautamkrishnar/keepalive-workflow@995aec69bb3f2b45b20f4e107907992c8715086d |