Check Caddy Releases #38
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 Caddy Releases and Build Docker Image | |
on: | |
schedule: | |
- cron: '*/5 * * * *' # Runs every 5 minutes | |
workflow_dispatch: # Allows manual triggering | |
permissions: | |
contents: write | |
jobs: | |
check-caddy-release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: pip install requests | |
- name: Check and compare Caddy release | |
id: check_release | |
run: python scripts/check_caddy_release.py | |
- name: Update version file | |
if: env.IS_NEW_RELEASE == 'true' | |
run: | | |
echo "{\"version\": \"${LATEST_VERSION}\"}" > version.json | |
git config --global user.name "vkartk" | |
git config --global user.email "[email protected]" | |
git add version.json | |
git commit -m "Update version to ${LATEST_VERSION}" | |
git push | |
- name: Create GitHub Release | |
if: env.IS_NEW_RELEASE == 'true' | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.LATEST_VERSION }} | |
release_name: "Caddy Release ${{ env.LATEST_VERSION }}" | |
body: "New Caddy release detected. See the full release notes [here](https://github.com/caddyserver/caddy/releases/tag/${{ env.LATEST_VERSION }})." | |
draft: false | |
prerelease: false |