Skip to content

Check for updates

Check for updates #38

name: Check for updates
on:
workflow_dispatch:
schedule:
- cron: '0 3 * * 6'
jobs:
get-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.REPO_SCOPED_TOKEN }}
- name: Create release dir
run: mkdir -p release-versions
- name: Fetch release version
run: |
curl https://api.github.com/repos/StevenBlack/hosts/releases/latest | \
jq -r ".tag_name" > release-versions/upstr_list_latest.txt
- name: Check for modified files
id: git-check
run: echo ::set-output name=modified::$([ -z "`git status --porcelain`" ] && echo "false" || echo "true")
- name: Commit latest release version
if: steps.git-check.outputs.modified == 'true'
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
touch release-versions/.gitkeep
git add release-versions/upstr_list_latest.txt
git commit -am "[AUTO] new release"
git push