Upstream Versions CI #892
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
#from https://stackoverflow.com/questions/58465057/trigger-a-github-action-when-another-repository-creates-a-new-release | |
name: Upstream Versions CI | |
on: | |
schedule: | |
- cron: '0 18 * * *' | |
workflow_dispatch: | |
jobs: | |
get-version: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.REPO_SCOPED_TOKEN }} | |
- name: Fetch release version | |
id: vars | |
run: | | |
curl -sL https://api.github.com/repos/caddyserver/caddy/releases/latest | jq -r ".tag_name" > versions/caddy.txt | |
curl -sL https://api.github.com/repos/keeweb/keeweb/releases/latest | jq -r ".tag_name" > versions/keeweb.txt | |
echo "caddy_version=$(cat versions/caddy.txt)" >> "$GITHUB_OUTPUT" | |
echo "keeweb_version=$(cat versions/keeweb.txt)" >> "$GITHUB_OUTPUT" | |
- 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 'Slurdge' | |
git config --global user.email 'slurdge@users.noreply.github.com' | |
git commit -am "Caddy: ${{ steps.vars.outputs.caddy_version }} - Keeweb: ${{ steps.vars.outputs.keeweb_version }}" | |
git push |