Skip to content

Commit 61c81b8

Browse files
authored
Release fixes (#353)
1 parent 5d2cebc commit 61c81b8

3 files changed

Lines changed: 36 additions & 7 deletions

File tree

.github/workflows/release-publish.yml

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,24 +69,53 @@ jobs:
6969
echo "CHANGELOG_EOF"
7070
} >> $GITHUB_OUTPUT
7171
72+
- name: Get contributors from changelog PRs
73+
id: contributors
74+
env:
75+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
CHANGELOG: ${{ steps.changelog.outputs.body }}
77+
run: |
78+
# Extract PR numbers from changelog links like [#123](...).
79+
PR_NUMBERS=$(echo "$CHANGELOG" | grep -oE '\[#[0-9]+\]' | tr -d '[]#' | sort -u)
80+
81+
CONTRIBUTORS=""
82+
if [ -n "$PR_NUMBERS" ]; then
83+
# Build a single GraphQL query to fetch all PR authors.
84+
QUERY='{ repository(owner: "${{ github.repository_owner }}", name: "${{ github.event.repository.name }}") {'
85+
while IFS= read -r PR; do
86+
[ -n "$PR" ] && QUERY="$QUERY pr$PR: pullRequest(number: $PR) { author { login } }"
87+
done <<< "$PR_NUMBERS"
88+
QUERY="$QUERY } }"
89+
90+
CONTRIBUTORS=$(gh api graphql -f query="$QUERY" \
91+
--jq '[.data.repository[].author.login] | unique | map("@" + .) | join(", ")')
92+
fi
93+
echo "list=$CONTRIBUTORS" >> $GITHUB_OUTPUT
94+
7295
- name: Create GitHub release
7396
env:
7497
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7598
TAG: ${{ steps.version.outputs.tag }}
7699
MERGE_SHA: ${{ github.event.pull_request.merge_commit_sha }}
77100
BODY: ${{ steps.changelog.outputs.body }}
101+
CONTRIBUTORS: ${{ steps.contributors.outputs.list }}
78102
run: |
79103
PRERELEASE_FLAG=""
80104
if [[ "${{ steps.version.outputs.prerelease }}" == "true" ]]; then
81105
PRERELEASE_FLAG="--prerelease"
82106
fi
83107
108+
NOTES="$BODY"
109+
if [ -n "$CONTRIBUTORS" ]; then
110+
NOTES="$(printf '%s\n\n**Contributors:** %s' "$BODY" "$CONTRIBUTORS")"
111+
fi
112+
84113
gh release create "$TAG" \
85114
--target "$MERGE_SHA" \
86115
--title "$TAG" \
87-
--notes "$BODY" \
116+
--notes "$NOTES" \
88117
$PRERELEASE_FLAG \
89-
"build/sqlite-database-integration.zip"
118+
"build/plugin-sqlite-database-integration.zip"
90119
91120
- name: Delete release branch
92121
env:

.github/workflows/release-wporg.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,21 @@ jobs:
3333
run: |
3434
gh release download "$RELEASE_TAG" \
3535
--repo "${{ github.repository }}" \
36-
--pattern "sqlite-database-integration.zip" \
36+
--pattern "plugin-sqlite-database-integration.zip" \
3737
--dir .
38-
unzip sqlite-database-integration.zip
38+
unzip plugin-sqlite-database-integration.zip
3939
4040
- name: Verify release metadata
4141
env:
4242
RELEASE_TAG: ${{ github.event.release.tag_name }}
4343
run: |
4444
VERSION="${RELEASE_TAG#v}"
45-
bash bin/verify-release-metadata.sh sqlite-database-integration "$VERSION"
45+
bash bin/verify-release-metadata.sh plugin-sqlite-database-integration "$VERSION"
4646
4747
- name: Deploy to WordPress.org
4848
uses: 10up/action-wordpress-plugin-deploy@v2
4949
env:
5050
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
5151
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
5252
SLUG: sqlite-database-integration
53-
BUILD_DIR: sqlite-database-integration
53+
BUILD_DIR: plugin-sqlite-database-integration

bin/prepare-release.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ if git rev-parse "$LATEST_TAG" >/dev/null 2>&1; then
7070
--limit 100 \
7171
--json number,title,mergedAt \
7272
--jq "sort_by(.mergedAt) | reverse | .[]
73-
| \"* \\(.title) ([#\\(.number)]($REPO_URL/pull/\\(.number)))\"" 2>/dev/null || true)"
73+
| \"* \\(.title) ([#\\(.number)]($REPO_URL/pull/\\(.number)))\"")"
7474
fi
7575

7676
if [ -z "$CHANGELOG" ]; then

0 commit comments

Comments
 (0)