Keep binary updated #600
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: Keep binary updated | |
# Periodically rebuild from the upstream "latest" releases, then raise a new | |
# pull-request if the binary file changed. | |
# | |
# Cribs heavily from this example: | |
# https://github.com/peter-evans/create-pull-request/blob/main/docs/examples.md#use-case-create-a-pull-request-to-modifyfix-pull-requests | |
on: | |
workflow_dispatch: | |
schedule: | |
# Runs every night around 4:20am EST/1:20am PST | |
- cron: "20 8 * * *" | |
jobs: | |
keep-binary-up-to-date: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Regenerate binary | |
run: make | |
- name: Did anything change? | |
id: vars | |
run: | | |
branchname="binary-update/${{ github.ref_name }}" | |
echo "branchname=${branchname}" >> $GITHUB_OUTPUT | |
binaryupdated=$(git status --porcelain | cut -d ' ' -f 2 | wc -l) | |
echo "binaryupdated=${binaryupdated}" >> $GITHUB_OUTPUT | |
- name: Create PR with changes | |
if: steps.vars.outputs.binaryupdated != 0 | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
commit-message: Update binary for ${{ github.ref_name }} | |
title: Update caddy binary for ${{ github.ref_name }} | |
body: This is an auto-generated PR to add an updated binary on ${{ github.ref_name }}. | |
labels: binary-update, automated-pr | |
branch: ${{ steps.vars.outputs.branchname }} | |
base: ${{ github.ref_name }} | |
sign-commits: true |