feat: add upstream release checker workflow
Runs weekly (Monday 8am) and on manual dispatch. Creates an issue when a new official Gitea release is available with merge instructions and release notes excerpt. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,111 @@
|
||||
# Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
|
||||
# SPDX-License-Identifier: MIT
|
||||
# Checks for new official Gitea releases and creates an issue when updates are available
|
||||
|
||||
name: Check Upstream Gitea Release
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 8 * * 1' # Every Monday at 8am
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
|
||||
jobs:
|
||||
check-upstream:
|
||||
name: Check for New Gitea Release
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Get Latest Upstream Release
|
||||
id: upstream
|
||||
run: |
|
||||
LATEST=$(curl -sf https://api.github.com/repos/go-gitea/gitea/releases/latest | jq -r '.tag_name')
|
||||
echo "version=${LATEST}" >> $GITHUB_OUTPUT
|
||||
echo "Latest upstream: ${LATEST}"
|
||||
|
||||
- name: Get Our Current Version
|
||||
id: current
|
||||
run: |
|
||||
# Our branch is based on v1.25.5
|
||||
CURRENT="v1.25.5"
|
||||
echo "version=${CURRENT}" >> $GITHUB_OUTPUT
|
||||
echo "Current base: ${CURRENT}"
|
||||
|
||||
- name: Compare Versions
|
||||
id: compare
|
||||
run: |
|
||||
UPSTREAM="${{ steps.upstream.outputs.version }}"
|
||||
CURRENT="${{ steps.current.outputs.version }}"
|
||||
|
||||
if [ "$UPSTREAM" != "$CURRENT" ]; then
|
||||
echo "needs_update=true" >> $GITHUB_OUTPUT
|
||||
echo "New release available: ${UPSTREAM} (we're on ${CURRENT})"
|
||||
else
|
||||
echo "needs_update=false" >> $GITHUB_OUTPUT
|
||||
echo "Up to date"
|
||||
fi
|
||||
|
||||
- name: Get Release Notes
|
||||
id: notes
|
||||
if: steps.compare.outputs.needs_update == 'true'
|
||||
run: |
|
||||
NOTES=$(curl -sf https://api.github.com/repos/go-gitea/gitea/releases/latest | jq -r '.body' | head -50)
|
||||
# Save to file to avoid quoting issues
|
||||
echo "$NOTES" > /tmp/release_notes.md
|
||||
|
||||
- name: Check for Existing Issue
|
||||
id: existing
|
||||
if: steps.compare.outputs.needs_update == 'true'
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GA_TOKEN }}
|
||||
run: |
|
||||
UPSTREAM="${{ steps.upstream.outputs.version }}"
|
||||
# Search for existing issue with this version
|
||||
EXISTING=$(curl -sf -H "Authorization: token ${GITEA_TOKEN}" \
|
||||
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/issues?state=open&type=issues&q=Upstream+release+${UPSTREAM}" \
|
||||
| jq 'length')
|
||||
echo "count=${EXISTING}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Create Issue
|
||||
if: steps.compare.outputs.needs_update == 'true' && steps.existing.outputs.count == '0'
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GA_TOKEN }}
|
||||
run: |
|
||||
UPSTREAM="${{ steps.upstream.outputs.version }}"
|
||||
CURRENT="${{ steps.current.outputs.version }}"
|
||||
NOTES=$(cat /tmp/release_notes.md | head -40)
|
||||
|
||||
BODY=$(cat << EOF
|
||||
## Upstream Gitea Release Available
|
||||
|
||||
**New version:** ${UPSTREAM}
|
||||
**Our base:** ${CURRENT}
|
||||
|
||||
### What to do
|
||||
|
||||
1. Fetch upstream changes: \`git fetch upstream ${UPSTREAM}\`
|
||||
2. Create merge branch: \`git checkout -b merge/${UPSTREAM} moko/1.25.5-project-api\`
|
||||
3. Merge upstream: \`git merge ${UPSTREAM}\`
|
||||
4. Resolve conflicts (especially in \`routers/api/v1/api.go\`)
|
||||
5. Rebuild and test: \`make backend\`
|
||||
6. Deploy new Docker image
|
||||
|
||||
### Release Notes (excerpt)
|
||||
|
||||
${NOTES}
|
||||
|
||||
### Links
|
||||
|
||||
- [Release page](https://github.com/go-gitea/gitea/releases/tag/${UPSTREAM})
|
||||
- [Changelog](https://github.com/go-gitea/gitea/blob/${UPSTREAM}/CHANGELOG.md)
|
||||
EOF
|
||||
)
|
||||
|
||||
curl -sf -X POST -H "Authorization: token ${GITEA_TOKEN}" -H "Content-Type: application/json" \
|
||||
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/issues" \
|
||||
-d "$(jq -n --arg title "Upstream release ${UPSTREAM} available (merge needed)" --arg body "$BODY" '{title: $title, body: $body, labels: []}')"
|
||||
|
||||
echo "Issue created for ${UPSTREAM}"
|
||||
Reference in New Issue
Block a user