Skip to content

Commit a003df2

Browse files
committed
refactor: simplify release flow — remove CHANGELOG.md, .changes files, draft release
- release-assistant.yml: rename release-gate→release-assistant, remove .changes validation - gen-release-pr.yml: remove CHANGELOG.md updates, .changes processing, draft release creation; trigger after Build completes; always update existing release-prep PR - release.yml: create release from scratch, reconstruct notes from git/API - docs.yml: manual dispatch only - generate_quickstart.sh: accept PLUGIN_VERSION/PLUGIN_SHA env vars - Contributing.md, AGENTS.md: updated release flow docs
1 parent 8560e24 commit a003df2

7 files changed

Lines changed: 783 additions & 115 deletions

File tree

.github/workflows/docs.yml

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,15 @@ defaults:
55

66
permissions:
77
contents: write
8-
pull-requests: write
98

109
env:
1110
DOTNET_VERSION: '8.0.x'
1211

1312
on:
14-
release:
15-
types: [ published ]
1613
workflow_dispatch:
1714

1815
jobs:
19-
generate-and-push-docs:
16+
generate-docs:
2017
runs-on: ubuntu-latest
2118

2219
steps:
@@ -30,17 +27,13 @@ jobs:
3027
with:
3128
dotnet-version: ${{ env.DOTNET_VERSION }}
3229

33-
- name: Updating docs
30+
- name: Regenerate docs
3431
run: ./docs/scripts/generate_all_docs.sh
3532

36-
- name: Create Pull Request
37-
uses: peter-evans/create-pull-request@v6
38-
env:
39-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40-
with:
41-
base: main
42-
title: update auto-generated docs
43-
commit-message: update docs
44-
branch: update-docs
45-
branch-suffix: timestamp
46-
delete-branch: true
33+
- name: Commit changes
34+
run: |
35+
git config user.name "github-actions[bot]"
36+
git config user.email "github-actions[bot]@users.noreply.github.com"
37+
git add -A
38+
git diff --quiet || git commit -m "docs: regenerate documentation"
39+
git push
Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
name: Generate Release PR
2+
3+
concurrency: release-prep-${{ github.ref_name }}
4+
5+
on:
6+
workflow_run:
7+
workflows: [Build]
8+
types: [completed]
9+
branches: [main]
10+
workflow_dispatch:
11+
inputs:
12+
release-type:
13+
type: choice
14+
description: Override release type
15+
options:
16+
- auto
17+
- major
18+
- minor
19+
- patch
20+
21+
permissions:
22+
contents: write
23+
pull-requests: write
24+
25+
jobs:
26+
accumulate-changes:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
with:
32+
token: ${{ secrets.GITHUB_TOKEN }}
33+
fetch-depth: 0
34+
35+
- name: Check if this is a release commit
36+
id: check-release
37+
run: |
38+
COMMIT_MSG=$(git log -1 --pretty=%B)
39+
echo "Commit message: $COMMIT_MSG"
40+
if echo "$COMMIT_MSG" | grep -q "chore: prepare release v"; then
41+
echo "This is a release commit, skipping workflow"
42+
echo "is-release=true" >> $GITHUB_OUTPUT
43+
else
44+
echo "Not a release commit, continuing workflow"
45+
echo "is-release=false" >> $GITHUB_OUTPUT
46+
fi
47+
48+
- name: Get all unreleased merged PRs and determine version
49+
if: steps.check-release.outputs.is-release == 'false'
50+
id: unreleased
51+
env:
52+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
run: |
54+
OWNER="${{ github.repository_owner }}"
55+
REPO="${{ github.event.repository.name }}"
56+
57+
LATEST_TAG=$(gh api repos/$OWNER/$REPO/releases/latest --jq '.tag_name' 2>/dev/null || echo "")
58+
echo "LATEST_TAG: $LATEST_TAG"
59+
60+
if [ -z "$LATEST_TAG" ]; then
61+
COMMITS=$(git log --oneline --grep="Merge pull request" --grep="#[0-9]" -E)
62+
else
63+
COMMITS=$(git log ${LATEST_TAG}..HEAD --oneline --grep="Merge pull request" --grep="#[0-9]" -E)
64+
fi
65+
66+
PATCH_COUNT=0
67+
MINOR_COUNT=0
68+
MAJOR_COUNT=0
69+
LABELED_PR_LIST=""
70+
MAJOR_PRS=""
71+
MINOR_PRS=""
72+
PATCH_PRS=""
73+
74+
while IFS= read -r commit; do
75+
PR_NUM=$(echo "$commit" | grep -oE '#[0-9]+' | tr -d '#' || echo "")
76+
if [ -n "$PR_NUM" ]; then
77+
LABELS=$(gh api repos/$OWNER/$REPO/pulls/$PR_NUM --jq '.labels[].name' 2>/dev/null || echo "")
78+
PR_TITLE=$(gh api repos/$OWNER/$REPO/pulls/$PR_NUM --jq '.title' 2>/dev/null || echo "PR #$PR_NUM")
79+
80+
LABELED_PR_LIST="$LABELED_PR_LIST #$PR_NUM"
81+
82+
if echo "$LABELS" | grep -q "major"; then
83+
MAJOR_COUNT=$((MAJOR_COUNT + 1))
84+
MAJOR_PRS="$MAJOR_PRS\n- $PR_TITLE (#$PR_NUM)"
85+
elif echo "$LABELS" | grep -q "minor"; then
86+
MINOR_COUNT=$((MINOR_COUNT + 1))
87+
MINOR_PRS="$MINOR_PRS\n- $PR_TITLE (#$PR_NUM)"
88+
elif echo "$LABELS" | grep -q "patch"; then
89+
PATCH_COUNT=$((PATCH_COUNT + 1))
90+
PATCH_PRS="$PATCH_PRS\n- $PR_TITLE (#$PR_NUM)"
91+
fi
92+
fi
93+
done <<< "$COMMITS"
94+
95+
if [ "$MAJOR_COUNT" -gt 0 ]; then
96+
RELEASE_TYPE="major"
97+
elif [ "$MINOR_COUNT" -gt 0 ]; then
98+
RELEASE_TYPE="minor"
99+
elif [ "$PATCH_COUNT" -gt 0 ]; then
100+
RELEASE_TYPE="patch"
101+
else
102+
RELEASE_TYPE="none"
103+
fi
104+
105+
if [ "${{ github.event.inputs.release-type }}" != "" ] && [ "${{ github.event.inputs.release-type }}" != "auto" ]; then
106+
RELEASE_TYPE="${{ github.event.inputs.release-type }}"
107+
echo "Release type overridden by workflow dispatch: $RELEASE_TYPE"
108+
fi
109+
110+
echo "Final release type: $RELEASE_TYPE"
111+
echo "release-type=$RELEASE_TYPE" >> $GITHUB_OUTPUT
112+
echo "labeled-pr-list=$LABELED_PR_LIST" >> $GITHUB_OUTPUT
113+
114+
- name: Compute new version
115+
if: steps.unreleased.outputs.release-type != 'none' && steps.unreleased.outputs.release-type != ''
116+
id: version-update
117+
run: |
118+
CURRENT_VERSION=$(git describe --tags $(git rev-list --tags --max-count=1) 2>/dev/null || echo "v0.0.0")
119+
echo "Current version: $CURRENT_VERSION"
120+
121+
BASE_VERSION=$(echo "$CURRENT_VERSION" | grep -o -E '[0-9]+\.[0-9]+\.[0-9]+' || echo "0.0.0")
122+
echo "Base version: $BASE_VERSION"
123+
124+
IFS='.' read -r major minor patch <<< "$BASE_VERSION"
125+
126+
RELEASE_TYPE="${{ steps.unreleased.outputs.release-type }}"
127+
echo "Release type: $RELEASE_TYPE"
128+
129+
if [ "$RELEASE_TYPE" = "major" ]; then
130+
NEW_BASE_VERSION="$((major+1)).0.0"
131+
elif [ "$RELEASE_TYPE" = "minor" ]; then
132+
NEW_BASE_VERSION="$major.$((minor+1)).0"
133+
else
134+
NEW_BASE_VERSION="$major.$minor.$((patch+1))"
135+
fi
136+
137+
NEW_VERSION="v${NEW_BASE_VERSION}"
138+
echo "New version: $NEW_VERSION"
139+
echo "new-version=$NEW_VERSION" >> $GITHUB_OUTPUT
140+
141+
- name: Download wasm artifact for sha computation
142+
if: steps.version-update.outputs.new-version != ''
143+
uses: dawidd6/action-download-artifact@v6
144+
with:
145+
github_token: ${{ secrets.GITHUB_TOKEN }}
146+
workflow: build.yml
147+
workflow_conclusion: success
148+
branch: main
149+
name: wasm-file
150+
151+
- name: Compute sha and regenerate docs
152+
if: steps.version-update.outputs.new-version != ''
153+
id: doc-gen
154+
env:
155+
PLUGIN_VERSION: ${{ steps.version-update.outputs.new-version }}
156+
run: |
157+
SHA256_HASH=$(sha256sum plugin.wasm | awk '{ print $1 }')
158+
echo "Computed sha256: $SHA256_HASH"
159+
echo "plugin-sha=$SHA256_HASH" >> $GITHUB_OUTPUT
160+
161+
export PLUGIN_VERSION="${{ steps.version-update.outputs.new-version }}"
162+
export PLUGIN_SHA="$SHA256_HASH"
163+
./docs/scripts/generate_all_docs.sh
164+
165+
echo "Re-generated documentation"
166+
git status
167+
168+
- name: Create release PR
169+
if: steps.version-update.outputs.new-version != ''
170+
uses: peter-evans/create-pull-request@v5
171+
with:
172+
token: ${{ secrets.GITHUB_TOKEN }}
173+
commit-message: "chore: prepare release ${{ steps.version-update.outputs.new-version }}"
174+
title: "Release Prep ${{ steps.version-update.outputs.new-version }}"
175+
body: |
176+
## Automated Release Prep
177+
178+
**Release Type:** ${{ steps.unreleased.outputs.release-type }}
179+
**New Version:** ${{ steps.version-update.outputs.new-version }}
180+
181+
This PR was created automatically. It updates documentation with the release version and sha.
182+
183+
When merged, the Release workflow will create the GitHub release with the accumulated release notes.
184+
branch: release-prep
185+
base: ${{ github.ref_name }}
186+
labels: |
187+
release
188+
automated

0 commit comments

Comments
 (0)