Fetch and Compare NxFilter version #1414
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
# This workflow checks version.txt against the current version generated by http://www.nxfilter.org/curver.php | |
# If the version string in version.txt differs from the generated string, | |
# a build job is triggered and the string in version.txt is updated. | |
name: Fetch and Compare NxFilter version | |
on: | |
schedule: | |
- cron: '0 13 * * *' | |
# push: | |
# branches: [ nxfilter-latest ] | |
env: | |
VERSION: "" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- uses: actions/setup-node@v3 | |
- name: Check version.txt against curver.php | |
run: | | |
echo "VERSION=$(curl --retry 10 http://www.nxfilter.org/curver.php)" >> $GITHUB_ENV | |
if [[ $(< version.txt) != "$VERSION" ]]; | |
then echo "UPDATE=true" >> $GITHUB_ENV && curl --retry 10 http://www.nxfilter.org/curver.php > version.txt; | |
awk '{print "http://pub.nxfilter.org/nxfilter-"$0".zip"}' version.txt > url.txt; | |
fi | |
- name: Push back to branch | |
uses: Automattic/action-commit-to-branch@master | |
with: | |
branch: 'nxfilter-latest' | |
commit_message: 'PUSH triggered by Github Actions' | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT }} |