Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 46 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
ref: ${{ github.event.release.tag_name }}
ref: main
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Generate versioned Makefiles from the release tag

For release events where main has advanced past (or otherwise differs from) the published tag, this checks out the current main Makefiles but scripts/generate-versioned-makefiles.sh pins PKG_SOURCE_URL/PKG_HASH to the release tag tarball. That can create a PR whose OpenWrt build recipe expects files/rules from main while downloading the older tagged source, so the versioned Makefiles for that release may not build. The previous tag checkout kept the template and tarball in sync; keep generating from ${{ github.event.release.tag_name }} and push the resulting commit to a PR branch targeting main.

Useful? React with 👍 / 👎.


- name: Set version environment variable
run: |
Expand All @@ -26,13 +27,54 @@ jobs:
- name: Generate versioned Makefiles
run: ./scripts/generate-versioned-makefiles.sh

- name: Commit and push versioned Makefiles
- name: Create pull request for versioned Makefiles
run: |
set -euo pipefail

git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

if git diff --quiet --exit-code -- \
openwrt-support/rtp2httpd/Makefile.versioned \
openwrt-support/luci-app-rtp2httpd/Makefile.versioned; then
echo "Versioned Makefiles are already up-to-date."
exit 0
fi

BRANCH="chore/versioned-makefiles-${{ github.event.release.tag_name }}"
TITLE="chore: update versioned Makefiles for ${{ github.event.release.tag_name }}"
BODY="Updates the OpenWrt versioned Makefiles generated for release ${{ github.event.release.tag_name }}."

git fetch origin "$BRANCH:refs/remotes/origin/$BRANCH" || true
git switch -c "$BRANCH"
git add openwrt-support/rtp2httpd/Makefile.versioned openwrt-support/luci-app-rtp2httpd/Makefile.versioned
git commit -m "chore: update versioned Makefiles for ${{ github.event.release.tag_name }}"
git push origin HEAD:main
git commit -m "$TITLE"
git push --force-with-lease origin "$BRANCH"

PR_NUMBER=$(gh pr list \
--repo "${{ github.repository }}" \
--head "$BRANCH" \
--base main \
--state open \
--json number \
--jq '.[0].number // ""')

if [ -n "$PR_NUMBER" ]; then
echo "Pull request #$PR_NUMBER already exists."
gh pr edit "$PR_NUMBER" \
--repo "${{ github.repository }}" \
--title "$TITLE" \
--body "$BODY"
else
gh pr create \
--repo "${{ github.repository }}" \
--base main \
--head "$BRANCH" \
--title "$TITLE" \
--body "$BODY"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

frontend:
name: Build frontend
Expand Down
Loading