Skip to content

Keep binary updated #158

Keep binary updated

Keep binary updated #158

---
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@v3
- 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@v4
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 }}