Check for New Caddy Release #67
This file contains hidden or 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 for New Caddy Release | |
on: | |
schedule: | |
- cron: '5 3 * * *' | |
workflow_dispatch: | |
jobs: | |
check-release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Get latest Caddy release tag | |
id: get_tag | |
run: | | |
LATEST_TAG=$(gh api /repos/caddyserver/caddy/releases/latest --jq .tag_name) | |
echo "LATEST_TAG=${LATEST_TAG}" >> $GITHUB_OUTPUT | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check if release tag is new by using it as a cache key | |
id: check | |
uses: actions/cache@v4 | |
with: | |
path: .cache | |
key: caddy-release-${{ steps.get_tag.outputs.LATEST_TAG }} | |
- name: Create cache marker if new release | |
if: steps.check.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p .cache | |
echo "${{ steps.get_tag.outputs.LATEST_TAG }}" > .cache/caddy-tag | |
- name: Trigger build workflow if new release found | |
if: steps.check.outputs.cache-hit != 'true' | |
uses: peter-evans/repository-dispatch@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
event-type: caddy-release |