Skip to content

Commit 8a09b89

Browse files
committed
fix(actions): re-add docs and discord step
1 parent c6e2418 commit 8a09b89

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

.github/workflows/release.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,59 @@ jobs:
8989
- name: "Echo release url"
9090
run: echo "${{ steps.pycord-release.outputs.gh-release }}"
9191

92+
docs_release:
93+
runs-on: ubuntu-latest
94+
needs: [lib_release,pre_config]
95+
if: needs.pre_config.outputs.is_rc == 'false' || (needs.pre_config.outputs.is_rc == 'true' && endsWith(needs.pre_config.outputs.version, '.0-rc1'))
96+
environment: release
97+
steps:
98+
- name: "Sync Versions on Read the Docs"
99+
run: |
100+
curl --location --request POST 'https://readthedocs.org/api/v3/projects/pycord/sync-versions/' \
101+
--header 'Content-Type: application/json' \
102+
--header "Authorization: Token ${{ secrets.READTHEDOCS_TOKEN }}"
103+
104+
- name: "Activate and Show Version on Read the Docs"
105+
run: |
106+
VERSION=${{ needs.pre_config.outputs.version }}
107+
MAJOR_MINOR_VERSION=$(echo $VERSION | grep -oE '^[0-9]+\.[0-9]+')
108+
PATCH_VERSION=${VERSION##*.}
109+
if [[ $PATCH_VERSION =~ ^[0-9]+$ ]]; then
110+
DOCS_VERSION="v$VERSION"
111+
else
112+
DOCS_VERSION="v$MAJOR_MINOR_VERSION.x"
113+
fi
114+
curl --location --request PATCH "https://readthedocs.org/api/v3/projects/pycord/versions/$DOCS_VERSION/" \
115+
--header 'Content-Type: application/json' \
116+
--header "Authorization: Token ${{ secrets.READTHEDOCS_TOKEN }}" \
117+
--data '{
118+
"active": true,
119+
"hidden": false
120+
}'
121+
122+
inform_discord:
123+
runs-on: ubuntu-latest
124+
needs: [lib_release,docs_release,close_milestone,pre_config]
125+
environment: release
126+
steps:
127+
- name: "Notify Discord"
128+
run: |
129+
VERSION=${{ needs.pre_config.outputs.version }}
130+
MAJOR_MINOR_VERSION=$(echo $VERSION | grep -oE '^[0-9]+\.[0-9]+')
131+
DOCS_URL="<https://docs.pycord.dev/en/v$VERSION/changelog.html>"
132+
GITHUB_COMPARE_URL="<https://github.com/Pycord-Development/pycord/compare/${{ needs.pre_config.outputs.previous_tag }}...v$VERSION>"
133+
GITHUB_RELEASE_URL="<https://github.com/Pycord-Development/pycord/releases/tag/v$VERSION>"
134+
PYPI_RELEASE_URL="<https://pypi.org/project/py-cord/$VERSION/>"
135+
ANNOUNCEMENT="## <:pycord:1063211537008955495> Pycord v${MAJOR_MINOR_VERSION} is out!\n\n"
136+
ANNOUNCEMENT="${ANNOUNCEMENT}[@everyone]\n\n"
137+
ANNOUNCEMENT="${ANNOUNCEMENT}You can view the changelog here: <$DOCS_URL>\n\n"
138+
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"
139+
ANNOUNCEMENT="${ANNOUNCEMENT}You can install this version by running the following command:\n\`\`\`sh\npip install -U py-cord==$VERSION\n\`\`\`\n\n"
140+
curl -H "Content-Type: application/json" \
141+
-X POST \
142+
-d "{\"content\":\"$ANNOUNCEMENT\"}" \
143+
${{ secrets.DISCORD_WEBHOOK_URL }}
144+
92145
determine_milestone_id:
93146
runs-on: ubuntu-latest
94147
needs: [lib_release,pre_config]

0 commit comments

Comments
 (0)