Florian Weber 589e5d8a0a
All checks were successful
Building and publishing Homebrewery as Docker Image / build (release) Successful in 11m39s
Update build workflow to trigger on release events and adjust update job to include token
2025-06-26 16:35:02 +02:00

72 lines
2.3 KiB
YAML

name: Updating to latest Homebrewery Release
on:
schedule:
- cron: '0 9,17 * * *'
workflow_dispatch:
concurrency:
group: "update-homebrewery"
cancel-in-progress: true
permissions:
contents: write
jobs:
update:
runs-on: ubuntu-24.04
steps:
- name: Get latest Homebrewery release via GitHub API
run: |
resp=$(curl -sSf \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.GH_TOKEN }}" \
https://api.github.com/repos/naturalcrit/homebrewery/releases/latest)
id=$( echo "$resp" | jq -r .id)
tag_name=$( echo "$resp" | jq -r .tag_name)
name=$( echo "$resp" | jq -r .name)
url=$( echo "$resp" | jq -r .url)
draft=$( echo "$resp" | jq -r .draft)
prerelease=$( echo "$resp" | jq -r .prerelease)
body_text=$( echo "$resp" | jq -r .body)
echo "ID=$id" >>"$GITHUB_ENV"
echo "TAG_NAME=$tag_name" >>"$GITHUB_ENV"
echo "NAME=$name" >>"$GITHUB_ENV"
echo "URL=$url" >>"$GITHUB_ENV"
echo "DRAFT=$draft" >>"$GITHUB_ENV"
echo "PRERELEASE=$prerelease" >>"$GITHUB_ENV"
{
echo "RELEASE_BODY<<EOF"
printf '%s\n' "# Homebrewery $name Image"
printf '\n'
printf '%s\n' "> _This is an automated Docker Image update. Nothing other than the Homebrewery version changed._"
printf '\n'
printf '%s\n' "$body_text"
printf '\n'
printf '%s\n' "See original Changelog from [$name]($html_url)"
echo "EOF"
} >>"$GITHUB_ENV"
- name: Debug step
run: |
echo "id: $ID"
echo "draft: $DRAFT"
echo "tag_name: $TAG_NAME"
echo "name: $NAME"
echo "url: $URL"
echo "prerelease: $PRERELEASE"
- name: Create Docker Release
uses: softprops/action-gh-release@v2
if: ${{ env.ID > 0 && env.DRAFT != 'true' }}
with:
token: ${{ secrets.GT_UPDATE_TOKEN }}
prerelease: ${{ env.PRERELEASE }}
name: ${{ env.NAME }}
tag_name: ${{ env.TAG_NAME }}
body: ${{ env.RELEASE_BODY }}