Skip to content

Commit def1b99

Browse files
authored
Merge branch 'master' into renovate/sphinx-autodoc-typehints-3.x
2 parents 45b71d5 + 117ba71 commit def1b99

25 files changed

+1090
-150
lines changed

.github/workflows/docs-json-export.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
id: generate-json
3636
run: python scripts/docs_json_exporter.py
3737
- name: Upload docs.json as artifact
38-
uses: actions/upload-artifact@v5.0.0
38+
uses: actions/upload-artifact@v6.0.0
3939
id: artifact-upload
4040
with:
4141
name: Pycord Docs JSON

.github/workflows/docs-localization-download.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
working-directory: ./docs
4141
- name: "Crowdin"
4242
id: crowdin
43-
uses: crowdin/github-action@v2.12.0
43+
uses: crowdin/github-action@v2.13.0
4444
with:
4545
upload_sources: false
4646
upload_translations: false

.github/workflows/docs-localization-upload.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
sphinx-intl update -p ./build/locales ${{ vars.SPHINX_LANGUAGES }}
4545
working-directory: ./docs
4646
- name: "Crowdin"
47-
uses: crowdin/github-action@v2.12.0
47+
uses: crowdin/github-action@v2.13.0
4848
with:
4949
upload_sources: true
5050
upload_translations: false

.github/workflows/release.yml

Lines changed: 50 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
is_rc: ${{ steps.determine_vars.outputs.is_rc }}
2929
version: ${{ steps.determine_vars.outputs.version }}
3030
previous_tag: ${{ steps.determine_vars.outputs.previous_tag }}
31+
previous_final_tag: ${{ steps.determine_vars.outputs.previous_final_tag }}
3132
runs-on: ubuntu-latest
3233
steps:
3334
- name: "Checkout Repository"
@@ -41,18 +42,24 @@ jobs:
4142
env:
4243
VERSION: ${{ github.event.inputs.version }}
4344
run: |
44-
VALID_VERSION_REGEX='^([0-9]+\.[0-9]+\.[0-9]+((a|b|rc|\.dev|\.post)[0-9]+)?)$'
45+
set -euo pipefail
46+
VALID_VERSION_REGEX='^[0-9]+\.[0-9]+\.[0-9]+(rc[0-9]+)?$'
4547
if ! [[ $VERSION =~ $VALID_VERSION_REGEX ]]; then
46-
echo "::error::Invalid version string '$VERSION'. Must match PEP 440 (e.g. 1.2.0, 1.2.0rc1, 1.2.0.dev1, 1.2.0a1, 1.2.0b1, 1.2.0.post1)"
48+
echo "::error::Invalid version string '$VERSION'. Only releases like 1.2.3 and release candidates like 1.2.3rc1 are supported."
4749
exit 1
4850
fi
49-
if ! [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && ! [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+rc[0-9]+$ ]]; then
50-
echo "::error::Unsupported version string '$VERSION'. Only normal releases (e.g. 1.2.3) and rc (e.g. 1.2.3rc1) are supported at this time."
51+
echo "version=$VERSION" >> $GITHUB_OUTPUT
52+
PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || git describe --tags --abbrev=0 2>/dev/null || true)
53+
if [[ -z "$PREVIOUS_TAG" ]]; then
54+
echo "::error::Could not determine previous tag. Ensure at least one tag exists."
5155
exit 1
5256
fi
53-
echo "version=$VERSION" >> $GITHUB_OUTPUT
54-
PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^)
5557
echo "previous_tag=${PREVIOUS_TAG}" >> $GITHUB_OUTPUT
58+
PREVIOUS_FINAL_TAG=$(git tag --sort=-v:refname | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | head -n1 || true)
59+
if [[ -z "$PREVIOUS_FINAL_TAG" ]]; then
60+
PREVIOUS_FINAL_TAG=$PREVIOUS_TAG
61+
fi
62+
echo "previous_final_tag=${PREVIOUS_FINAL_TAG}" >> $GITHUB_OUTPUT
5663
MAJOR_MINOR_VERSION=$(echo $VERSION | grep -oE '^[0-9]+\.[0-9]+')
5764
echo "branch_name=v${MAJOR_MINOR_VERSION}.x" >> $GITHUB_OUTPUT
5865
if [[ $VERSION == *rc* ]]; then
@@ -146,17 +153,23 @@ jobs:
146153
shell: bash
147154
env:
148155
VERSION: ${{ inputs.version }}
156+
PREVIOUS_TAG: ${{ needs.pre_config.outputs.previous_tag }}
157+
PREVIOUS_FINAL_TAG: ${{ needs.pre_config.outputs.previous_final_tag }}
149158
REPOSITORY: ${{ github.repository }}
150159
GITHUB_TOKEN: ${{ secrets.ADMIN_GITHUB_TOKEN }}
151160
BRANCH: ${{ github.ref_name }}
152161
run: |
153162
git config user.name "NyuwBot"
154163
git config user.email "[email protected]"
155164
DATE=$(date +'%Y-%m-%d')
156-
sed -i "/These changes are available on the \`.*\` branch, but have not yet been released\./{N;d;}" CHANGELOG.md
157-
sed -i "s/## \[Unreleased\]/## [$VERSION] - $DATE/" CHANGELOG.md
158-
sed -i "0,/## \[$VERSION\]/ s|## \[$VERSION\]|## [Unreleased]\n\nThese changes are available on the \`$BRANCH\` branch, but have not yet been released.\n\n### Added\n\n### Changed\n\n### Fixed\n\n### Deprecated\n\n### Removed\n\n&|" CHANGELOG.md
159-
sed -i "s|\[unreleased\]:.*|[unreleased]: https://github.com/$REPOSITORY/compare/v$VERSION...HEAD\n[$VERSION]: https://github.com/$REPOSITORY/compare/$(git describe --tags --abbrev=0 @^)...v$VERSION|" CHANGELOG.md
165+
python scripts/release_changelog.py \
166+
--path CHANGELOG.md \
167+
--version "$VERSION" \
168+
--previous-tag "$PREVIOUS_TAG" \
169+
--previous-final-tag "$PREVIOUS_FINAL_TAG" \
170+
--branch "$BRANCH" \
171+
--repository "$REPOSITORY" \
172+
--date "$DATE"
160173
git add CHANGELOG.md
161174
git commit -m "chore(release): update CHANGELOG.md for version $VERSION"
162175
- name: "Commit and Push Changelog to ${{ github.ref_name }}"
@@ -202,7 +215,7 @@ jobs:
202215
python3 -m build --sdist
203216
python3 -m build --wheel
204217
- name: "Create GitHub Release"
205-
uses: softprops/action-gh-release@v2.4.2
218+
uses: softprops/action-gh-release@v2.5.0
206219
id: gh-release
207220
with:
208221
tag_name: "v${{ inputs.version }}"
@@ -235,67 +248,42 @@ jobs:
235248
docs_release:
236249
runs-on: ubuntu-latest
237250
needs: [lib_release, pre_config]
238-
if:
239-
${{ needs.pre_config.outputs.is_rc == 'false' || (needs.pre_config.outputs.is_rc
240-
== 'true' && endsWith(needs.pre_config.outputs.version, '0rc1')) }}
241251
environment: release
242252
steps:
243-
- name: "Sync Versions on Read the Docs"
244-
run: |
245-
curl --location --request POST 'https://readthedocs.org/api/v3/projects/pycord/sync-versions/' \
246-
--header 'Content-Type: application/json' \
247-
--header "Authorization: Token ${{ secrets.READTHEDOCS_TOKEN }}"
253+
- name: "Checkout repository"
254+
uses: actions/checkout@v6
255+
with:
256+
fetch-depth: 0
257+
fetch-tags: true
248258

249-
- name: "Activate and Show Version on Read the Docs"
259+
- name: "Sync and activate version on Read the Docs"
260+
env:
261+
READTHEDOCS_TOKEN: ${{ secrets.READTHEDOCS_TOKEN }}
250262
run: |
251-
VERSION=${{ needs.pre_config.outputs.version }}
252-
MAJOR_MINOR_VERSION=$(echo $VERSION | grep -oE '^[0-9]+\.[0-9]+')
253-
HIDDEN=$([[ $VERSION == *rc* ]] && echo true || echo false)
254-
if [[ $VERSION == *rc* ]]; then
255-
DOCS_VERSION="v${MAJOR_MINOR_VERSION}.x"
256-
else
257-
DOCS_VERSION="v$VERSION"
258-
fi
259-
curl --location --request PATCH "https://readthedocs.org/api/v3/projects/pycord/versions/$DOCS_VERSION/" \
260-
--header 'Content-Type: application/json' \
261-
--header "Authorization: Token ${{ secrets.READTHEDOCS_TOKEN }}" \
262-
--data '{
263-
"active": true,
264-
"hidden": $HIDDEN
265-
}'
263+
python3 scripts/release_rtd_versions.py \
264+
--project pycord \
265+
--version "${{ needs.pre_config.outputs.version }}" \
266+
--sync
266267
267268
inform_discord:
268269
runs-on: ubuntu-latest
269270
needs: [docs_release, lib_release, pre_config]
270271
environment: release
271272
steps:
273+
- name: "Checkout repository"
274+
uses: actions/checkout@v6
275+
with:
276+
fetch-depth: 0
277+
fetch-tags: true
278+
272279
- name: "Notify Discord"
273-
run: |
274-
VERSION=${{ needs.pre_config.outputs.version }}
275-
MAJOR_MINOR_VERSION=$(echo $VERSION | grep -oE '^[0-9]+\.[0-9]+')
276-
DOCS_URL="<https://docs.pycord.dev/en/v$VERSION/changelog.html>"
277-
GITHUB_COMPARE_URL="<https://github.com/Pycord-Development/pycord/compare/${{ needs.pre_config.outputs.previous_tag }}...v$VERSION>"
278-
GITHUB_RELEASE_URL="<https://github.com/Pycord-Development/pycord/releases/tag/v$VERSION>"
279-
PYPI_RELEASE_URL="<https://pypi.org/project/py-cord/$VERSION/>"
280-
if [[ $VERSION == *rc* ]]; then
281-
ANNOUNCEMENT="## <:pycord:1063211537008955495> Pycord v$VERSION Release Candidate ($MAJOR_MINOR_VERSION) is available!\n\n"
282-
ANNOUNCEMENT="${ANNOUNCEMENT}@here\n\n"
283-
ANNOUNCEMENT="${ANNOUNCEMENT}This is a pre-release (release candidate) for testing and feedback.\n\n"
284-
ANNOUNCEMENT="${ANNOUNCEMENT}You can view the changelog here: <$DOCS_URL>\n\n"
285-
ANNOUNCEMENT="${ANNOUNCEMENT}Check out the [GitHub changelog]($GITHUB_COMPARE_URL), [GitHub release page]($GITHUB_RELEASE_URL), and [PyPI release page]($PYPI_RELEASE_URL).\n\n"
286-
ANNOUNCEMENT="${ANNOUNCEMENT}You can install this version by running the following command:\n\`\`\`sh\npip install -U py-cord==$VERSION\n\`\`\`\n\n"
287-
ANNOUNCEMENT="${ANNOUNCEMENT}Please try it out and let us know your feedback or any issues!"
288-
else
289-
ANNOUNCEMENT="## <:pycord:1063211537008955495> Pycord v${VERSION} is out!\n\n"
290-
ANNOUNCEMENT="${ANNOUNCEMENT}@everyone\n\n"
291-
ANNOUNCEMENT="${ANNOUNCEMENT}You can view the changelog here: <$DOCS_URL>\n\n"
292-
ANNOUNCEMENT="${ANNOUNCEMENT}Feel free to take a look at the [GitHub changelog]($GITHUB_COMPARE_URL), [GitHub release page]($GITHUB_RELEASE_URL) and the [PyPI release page]($PYPI_RELEASE_URL).\n\n"
293-
ANNOUNCEMENT="${ANNOUNCEMENT}You can install this version by running the following command:\n\`\`\`sh\npip install -U py-cord==$VERSION\n\`\`\`"
294-
fi
295-
curl -H "Content-Type: application/json" \
296-
-X POST \
297-
-d "{\"content\":\"$ANNOUNCEMENT\",\"allowed_mentions\":{\"parse\":[\"everyone\",\"roles\"]}}" \
298-
${{ secrets.DISCORD_WEBHOOK_URL }}
280+
env:
281+
VERSION: ${{ needs.pre_config.outputs.version }}
282+
PREVIOUS_TAG: ${{ needs.pre_config.outputs.previous_tag }}
283+
PREVIOUS_FINAL_TAG: ${{ needs.pre_config.outputs.previous_final_tag }}
284+
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
285+
REPOSITORY: ${{ github.repository }}
286+
run: python scripts/discord_release_notification.py
299287

300288
determine_milestone_id:
301289
runs-on: ubuntu-latest
@@ -344,7 +332,7 @@ jobs:
344332
- name: "Create New Milestone"
345333
run: |
346334
gh extension install valeriobelli/gh-milestone
347-
gh milestone create "${{ needs.determine_milestone_id.outputs.new_milestone_version }}"
335+
gh milestone create -t "${{ needs.determine_milestone_id.outputs.new_milestone_version }}"
348336
349337
# branch_protection_restore:
350338
# runs-on: ubuntu-latest

0 commit comments

Comments
 (0)