99 lines
3.2 KiB
YAML
99 lines
3.2 KiB
YAML
name: Updating to latest Homebrewery Release
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 17 * * *'
|
|
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: "update-homebrewery"
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
update:
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- name: Check current license
|
|
run: |
|
|
resp=$(curl -sSf \
|
|
-H "Accept: application/vnd.github.v3+json" \
|
|
-H "Authorization: token ${{ secrets.GH_TOKEN }}" \
|
|
https://api.github.com/repos/naturalcrit/homebrewery)
|
|
|
|
license=$(echo "$resp" | jq -r .license.spdx_id)
|
|
|
|
echo "LICENSE=$license" >>"$GITHUB_ENV"
|
|
|
|
- name: Get latest Homebrewery release via GitHub API
|
|
if: ${{ env.LICENSE == 'MIT' }}
|
|
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 .html_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]($url)"
|
|
echo "EOF"
|
|
} >>"$GITHUB_ENV"
|
|
|
|
- name: Debug step
|
|
if: ${{ env.LICENSE == 'MIT' }}
|
|
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.LICENSE == 'MIT' && 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 }}
|
|
|
|
- name: Checkout Repository for issue template
|
|
if: ${{ env.LICENSE != 'MIT' }}
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Create License changed issue
|
|
uses: JasonEtco/create-an-issue@v2
|
|
if: ${{ env.LICENSE != 'MIT' }}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GT_UPDATE_TOKEN }}
|
|
with:
|
|
update_existing: true
|
|
search_existing: open
|
|
filename: .gitea/ISSUE_LICENSE_CHANGED.md
|