Skip to content

Commit 15be560

Browse files
authored
Merge branch 'master' into master
2 parents 9ab80d2 + 7f2beb7 commit 15be560

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1228
-857
lines changed

.github/dependabot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ updates:
1010
major-version-bumps:
1111
update-types: ["major"]
1212
schedule:
13-
interval: "weekly"
13+
interval: "daily"
1414
commit-message:
1515
prefix: "chore"
1616
prefix-development: "chore"
@@ -25,7 +25,7 @@ updates:
2525
major-version-bumps:
2626
update-types: ["major"]
2727
schedule:
28-
interval: "weekly"
28+
interval: "daily"
2929
commit-message:
3030
prefix: "ci"
3131
include: "scope"

.github/workflows/docs-checks.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ on:
1717
- "*.toml"
1818
- "*.py"
1919
workflow_dispatch:
20+
inputs:
21+
with_linkcheck:
22+
type: boolean
23+
description: "Whether to run the linkcheck"
24+
default: true
2025
schedule:
2126
- cron: "0 0 * * *"
2227

@@ -44,7 +49,7 @@ jobs:
4449
python -m pip install -U pip
4550
pip install ".[docs]"
4651
- name: "Check Links"
47-
if: ${{ github.event_name == 'schedule' }}
52+
if: ${{ github.event_name == 'schedule' || inputs.with_linkcheck }}
4853
run: |
4954
cd docs
5055
make linkcheck

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ jobs:
99
download:
1010
name: "Download localizations from Crowdin"
1111
runs-on: ubuntu-latest
12+
environment: translations
1213
outputs:
1314
pr_ref: ${{ steps.convert_outputs.outputs.pr_ref }}
1415
pr_id: ${{ steps.convert_outputs.outputs.pr_id }}
@@ -35,7 +36,7 @@ jobs:
3536
working-directory: ./docs
3637
- name: "Build locales"
3738
run:
38-
sphinx-intl update -p ./build/locales -l ja -l de -l ja -l fr -l it -l en -l hi -l ko -l pt_BR -l es -l zh_CN -l ru
39+
sphinx-intl update -p ./build/locales ${{ vars.SPHINX_LANGUAGES }}
3940
working-directory: ./docs
4041
- name: "Crowdin"
4142
id: crowdin
@@ -44,19 +45,19 @@ jobs:
4445
upload_sources: false
4546
upload_translations: false
4647
download_translations: false
47-
download_bundle: ${{ secrets.CROWDIN_BUNDLE_ID }}
48-
localization_branch_name: l10n_master
48+
download_bundle: ${{ vars.CROWDIN_BUNDLE_ID }}
49+
localization_branch_name: ${{ vars.CROWDIN_LOCALIZATION_BRANCH }}
4950
create_pull_request: true
50-
pull_request_title: "docs: Update localizations from Crowdin"
51-
pull_request_body: "Crowdin download was triggered due to completely translated file or project. Starting sync. CC @Lulalaby"
51+
pull_request_title: ${{ vars.CROWDIN_PR_TITLE }}
52+
pull_request_body: ${{ vars.CROWDIN_PR_BODY }}
5253
pull_request_base_branch_name: "master"
5354
pull_request_reviewers: "Lulalaby"
5455
config: "crowdin.yml"
5556
base_path: "."
56-
commit_message: "docs: Update localizations from Crowdin"
57+
commit_message: ${{ vars.CROWDIN_COMMIT_MSG }}
5758
env:
5859
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }}
59-
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
60+
CROWDIN_PROJECT_ID: ${{ vars.CROWDIN_PROJECT_ID }}
6061
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }}
6162
- name: "Convert Outputs"
6263
id: convert_outputs
@@ -70,6 +71,7 @@ jobs:
7071
name: "PR operations"
7172
needs: [download]
7273
runs-on: ubuntu-latest
74+
environment: translations
7375
steps:
7476
- name: "Checkout Repository"
7577
uses: actions/checkout@v4
@@ -121,7 +123,7 @@ jobs:
121123
#workflow: version-updates.yml
122124
#ref: ${{ steps.convert_outputs.outputs.pr_ref }}
123125
- name: "Auto Approve"
124-
run: gh pr review --approve -b "auto-approval for localization sync :3" "$PR_ID"
126+
run: gh pr review --approve -b "Auto-approval for localization sync" "$PR_ID"
125127
env:
126128
PR_ID: ${{ steps.convert_outputs.outputs.pr_id }}
127129
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@ jobs:
1717
name: "Upload localization base to Crowdin"
1818
runs-on: ubuntu-latest
1919
if: ${{ contains(github.event.head_commit.message, '!crowdin upload') || github.event_name == 'workflow_dispatch' }}
20+
environment: translations
2021
steps:
21-
- uses: actions/checkout@v4
22+
- name: "Checkout Repository"
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-tags: true
2226
- name: "Install Python"
2327
uses: actions/setup-python@v5
2428
with:
@@ -37,18 +41,18 @@ jobs:
3741
working-directory: ./docs
3842
- name: "Build locales"
3943
run:
40-
sphinx-intl update -p ./build/locales -l ja -l de -l ja -l fr -l it -l en -l hi -l ko -l pt_BR -l es -l zh_CN -l ru
44+
sphinx-intl update -p ./build/locales ${{ vars.SPHINX_LANGUAGES }}
4145
working-directory: ./docs
4246
- name: "Crowdin"
4347
uses: crowdin/github-action@v2
4448
with:
4549
upload_sources: true
4650
upload_translations: false
4751
download_translations: false
48-
localization_branch_name: l10n_master
52+
localization_branch_name: ${{ vars.CROWDIN_LOCALIZATION_BRANCH }}
4953
create_pull_request: false
5054
config: "crowdin.yml"
5155
env:
5256
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }}
53-
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
57+
CROWDIN_PROJECT_ID: ${{ vars.CROWDIN_PROJECT_ID }}
5458
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }}

.github/workflows/readthedocs.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: "Read The Docs Localization"
2+
3+
on:
4+
push:
5+
branches: [master]
6+
paths:
7+
- "discord/**"
8+
- "docs/**"
9+
workflow_dispatch:
10+
schedule:
11+
- cron: "0 0 * * 1"
12+
13+
permissions: write-all
14+
15+
jobs:
16+
localization_builds:
17+
runs-on: ubuntu-latest
18+
environment: documentation
19+
strategy:
20+
matrix:
21+
rdt_projects: [
22+
"pycord-spanish",
23+
"pycord-japanese",
24+
"pycord-brazilian",
25+
"pycord-russian",
26+
"pycord-german",
27+
"pycord-hindi",
28+
"pycord-korean",
29+
"pycord-italian",
30+
"pycord-chinese",
31+
"pycord-french"
32+
]
33+
steps:
34+
- name: "Trigger RDT ${{ matrix.rdt_projects }}"
35+
run: |
36+
PROJECT=${{ matrix.rdt_projects }}
37+
curl --location --request POST "https://readthedocs.org/api/v3/projects/$PROJECT/versions/master/builds/" \
38+
--header 'Content-Type: application/json' \
39+
--header "Authorization: Token ${{ secrets.READTHEDOCS_TOKEN }}"

.github/workflows/release.yml

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
name: "Release"
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
type: string
8+
description: "Version number to release (e.g., 1.2.3, 1.2.3-rc1, 1.2.0)"
9+
required: true
10+
11+
permissions: write-all
12+
13+
jobs:
14+
safety_check:
15+
runs-on: ubuntu-latest
16+
environment: release
17+
steps:
18+
- name: "Security Check"
19+
uses: Aiko-IT-Systems/[email protected]
20+
with:
21+
whitelisted-github-ids: ${{ vars.ALLOWED_USER_IDS }}
22+
token: ${{ secrets.GITHUB_TOKEN }}
23+
24+
pre_config:
25+
needs: [safety_check]
26+
outputs:
27+
branch_name: ${{ steps.determine_vars.outputs.branch_name }}
28+
is_rc: ${{ steps.determine_vars.outputs.is_rc }}
29+
version: ${{ steps.determine_vars.outputs.version }}
30+
previous_tag: ${{ steps.determine_vars.outputs.previous_tag }}
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: "Checkout Repository"
34+
uses: actions/checkout@v4
35+
with:
36+
fetch-depth: 0
37+
fetch-tags: true
38+
39+
- name: "Determine Push Branch"
40+
id: determine_vars
41+
env:
42+
VERSION: ${{ github.event.inputs.version }}
43+
run: |
44+
echo "version=$VERSION" >> $GITHUB_OUTPUT
45+
PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^)
46+
echo "previous_tag=${PREVIOUS_TAG}" >> $GITHUB_OUTPUT
47+
if [[ $VERSION =~ -rc ]]; then
48+
MAJOR_MINOR_VERSION=$(echo $VERSION | grep -oE '^[0-9]+\.[0-9]+')
49+
echo "branch_name=v${MAJOR_MINOR_VERSION}.x" >> $GITHUB_OUTPUT
50+
echo "is_rc=true" >> $GITHUB_OUTPUT
51+
elif [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
52+
MAJOR_MINOR_VERSION=$(echo $VERSION | grep -oE '^[0-9]+\.[0-9]+')
53+
echo "branch_name=v${MAJOR_MINOR_VERSION}.x" >> $GITHUB_OUTPUT
54+
echo "is_rc=false" >> $GITHUB_OUTPUT
55+
else
56+
MAJOR_MINOR_VERSION=$(echo $VERSION | grep -oE '^[0-9]+\.[0-9]+')
57+
echo "branch_name=v${MAJOR_MINOR_VERSION}.x" >> $GITHUB_OUTPUT
58+
echo "is_rc=false" >> $GITHUB_OUTPUT
59+
fi
60+
61+
lib_release:
62+
needs: [safety_check,pre_config]
63+
runs-on: ubuntu-latest
64+
environment: release
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
steps:
68+
- name: "Checkout Repository"
69+
uses: actions/checkout@v4
70+
with:
71+
fetch-depth: 0
72+
fetch-tags: true
73+
74+
- name: "Release Pycord"
75+
id: pycord-release
76+
uses: Aiko-IT-Systems/[email protected]
77+
with:
78+
github-token: ${{ secrets.GITHUB_TOKEN }}
79+
pypi-token: ${{ secrets.PYPI_TOKEN }}
80+
version-branch-name: ${{ needs.pre_config.outputs.branch_name }}
81+
ref: ${{ github.ref_name }}
82+
repository: ${{ github.repository }}
83+
python-version: "3.12"
84+
release-requirements: "requirements/_release.txt"
85+
version: ${{ needs.pre_config.outputs.version }}
86+
is-rc: ${{ needs.pre_config.outputs.is_rc }}
87+
pypi-package: "py-cord"
88+
89+
- name: "Echo release url"
90+
run: echo "${{ steps.pycord-release.outputs.gh-release }}"
91+
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+
145+
determine_milestone_id:
146+
runs-on: ubuntu-latest
147+
needs: [lib_release,pre_config]
148+
if: ${{ !contains(needs.pre_config.outputs.version, '-') && endsWith(needs.pre_config.outputs.version, '.0') }}
149+
outputs:
150+
old_milestone_version: ${{ steps.extract_version.outputs.old_milestone_version }}
151+
new_milestone_version: ${{ steps.extract_version.outputs.new_milestone_version }}
152+
env:
153+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
154+
environment: release
155+
steps:
156+
- name: "Extract Milestone Version"
157+
id: extract_version
158+
run: |
159+
gh extension install valeriobelli/gh-milestone
160+
VERSION=${{ needs.pre_config.outputs.version }}
161+
OLD_MILESTONE_VERSION=$(gh milestone list --query "v2.7" | grep "#" | awk '{print $2}')
162+
NEW_MILESTONE_VERSION="v$(echo $VERSION | grep -oE '^[0-9]+\.[0-9]+')"
163+
echo "old_milestone_version=$OLD_MILESTONE_VERSION" >> $GITHUB_OUTPUT
164+
echo "new_milestone_version=$NEW_MILESTONE_VERSION" >> $GITHUB_OUTPUT
165+
166+
close_milestone:
167+
runs-on: ubuntu-latest
168+
needs: [determine_milestone_id,pre_config]
169+
if: ${{ !contains(needs.pre_config.outputs.version, '-') && endsWith(needs.pre_config.outputs.version, '.0') }}
170+
environment: release
171+
env:
172+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
173+
steps:
174+
- name: "Checkout Repository"
175+
uses: actions/checkout@v4
176+
with:
177+
fetch-depth: 0
178+
fetch-tags: true
179+
180+
- name: "Close Milestone"
181+
run: |
182+
gh extension install valeriobelli/gh-milestone
183+
OLD_MILESTONE_ID=$(gh milestone list --query "${{ needs.determine_milestone_id.outputs.old_milestone_version }}" | grep "#" | cut -d' ' -f2 | cut -d '#' -f2)
184+
gh milestone edit $OLD_MILESTONE_ID --state closed
185+
186+
- name: "Create New Milestone"
187+
run: |
188+
gh extension install valeriobelli/gh-milestone
189+
gh milestone create "${{ needs.determine_milestone_id.outputs.new_milestone_version }}"

.github/workflows/todo-checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: "Checkout Repository"
2424
uses: actions/checkout@v4
2525
- name: "Track TODO Action"
26-
uses: ribtoks/[email protected].11-beta
26+
uses: ribtoks/[email protected].12-beta
2727
with:
2828
TOKEN: ${{ secrets.GITHUB_TOKEN }}
2929
REPO: ${{ github.repository }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ docs/changelog.md
186186
# Translations
187187
docs/build/html
188188
docs/build/doctrees
189+
docs/build/linkcheck
189190
!docs/build/locales/*
190191
*.mo
191192
!docs/locales/*

0 commit comments

Comments
 (0)