Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Readeem authored Aug 29, 2024
2 parents 9ab80d2 + 7f2beb7 commit 15be560
Show file tree
Hide file tree
Showing 71 changed files with 1,228 additions and 857 deletions.
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ updates:
major-version-bumps:
update-types: ["major"]
schedule:
interval: "weekly"
interval: "daily"
commit-message:
prefix: "chore"
prefix-development: "chore"
Expand All @@ -25,7 +25,7 @@ updates:
major-version-bumps:
update-types: ["major"]
schedule:
interval: "weekly"
interval: "daily"
commit-message:
prefix: "ci"
include: "scope"
7 changes: 6 additions & 1 deletion .github/workflows/docs-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ on:
- "*.toml"
- "*.py"
workflow_dispatch:
inputs:
with_linkcheck:
type: boolean
description: "Whether to run the linkcheck"
default: true
schedule:
- cron: "0 0 * * *"

Expand Down Expand Up @@ -44,7 +49,7 @@ jobs:
python -m pip install -U pip
pip install ".[docs]"
- name: "Check Links"
if: ${{ github.event_name == 'schedule' }}
if: ${{ github.event_name == 'schedule' || inputs.with_linkcheck }}
run: |
cd docs
make linkcheck
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/docs-localization-download.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
download:
name: "Download localizations from Crowdin"
runs-on: ubuntu-latest
environment: translations
outputs:
pr_ref: ${{ steps.convert_outputs.outputs.pr_ref }}
pr_id: ${{ steps.convert_outputs.outputs.pr_id }}
Expand All @@ -35,7 +36,7 @@ jobs:
working-directory: ./docs
- name: "Build locales"
run:
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
sphinx-intl update -p ./build/locales ${{ vars.SPHINX_LANGUAGES }}
working-directory: ./docs
- name: "Crowdin"
id: crowdin
Expand All @@ -44,19 +45,19 @@ jobs:
upload_sources: false
upload_translations: false
download_translations: false
download_bundle: ${{ secrets.CROWDIN_BUNDLE_ID }}
localization_branch_name: l10n_master
download_bundle: ${{ vars.CROWDIN_BUNDLE_ID }}
localization_branch_name: ${{ vars.CROWDIN_LOCALIZATION_BRANCH }}
create_pull_request: true
pull_request_title: "docs: Update localizations from Crowdin"
pull_request_body: "Crowdin download was triggered due to completely translated file or project. Starting sync. CC @Lulalaby"
pull_request_title: ${{ vars.CROWDIN_PR_TITLE }}
pull_request_body: ${{ vars.CROWDIN_PR_BODY }}
pull_request_base_branch_name: "master"
pull_request_reviewers: "Lulalaby"
config: "crowdin.yml"
base_path: "."
commit_message: "docs: Update localizations from Crowdin"
commit_message: ${{ vars.CROWDIN_COMMIT_MSG }}
env:
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PROJECT_ID: ${{ vars.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }}
- name: "Convert Outputs"
id: convert_outputs
Expand All @@ -70,6 +71,7 @@ jobs:
name: "PR operations"
needs: [download]
runs-on: ubuntu-latest
environment: translations
steps:
- name: "Checkout Repository"
uses: actions/checkout@v4
Expand Down Expand Up @@ -121,7 +123,7 @@ jobs:
#workflow: version-updates.yml
#ref: ${{ steps.convert_outputs.outputs.pr_ref }}
- name: "Auto Approve"
run: gh pr review --approve -b "auto-approval for localization sync :3" "$PR_ID"
run: gh pr review --approve -b "Auto-approval for localization sync" "$PR_ID"
env:
PR_ID: ${{ steps.convert_outputs.outputs.pr_id }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/docs-localization-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ jobs:
name: "Upload localization base to Crowdin"
runs-on: ubuntu-latest
if: ${{ contains(github.event.head_commit.message, '!crowdin upload') || github.event_name == 'workflow_dispatch' }}
environment: translations
steps:
- uses: actions/checkout@v4
- name: "Checkout Repository"
uses: actions/checkout@v4
with:
fetch-tags: true
- name: "Install Python"
uses: actions/setup-python@v5
with:
Expand All @@ -37,18 +41,18 @@ jobs:
working-directory: ./docs
- name: "Build locales"
run:
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
sphinx-intl update -p ./build/locales ${{ vars.SPHINX_LANGUAGES }}
working-directory: ./docs
- name: "Crowdin"
uses: crowdin/github-action@v2
with:
upload_sources: true
upload_translations: false
download_translations: false
localization_branch_name: l10n_master
localization_branch_name: ${{ vars.CROWDIN_LOCALIZATION_BRANCH }}
create_pull_request: false
config: "crowdin.yml"
env:
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PROJECT_ID: ${{ vars.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }}
39 changes: 39 additions & 0 deletions .github/workflows/readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: "Read The Docs Localization"

on:
push:
branches: [master]
paths:
- "discord/**"
- "docs/**"
workflow_dispatch:
schedule:
- cron: "0 0 * * 1"

permissions: write-all

jobs:
localization_builds:
runs-on: ubuntu-latest
environment: documentation
strategy:
matrix:
rdt_projects: [
"pycord-spanish",
"pycord-japanese",
"pycord-brazilian",
"pycord-russian",
"pycord-german",
"pycord-hindi",
"pycord-korean",
"pycord-italian",
"pycord-chinese",
"pycord-french"
]
steps:
- name: "Trigger RDT ${{ matrix.rdt_projects }}"
run: |
PROJECT=${{ matrix.rdt_projects }}
curl --location --request POST "https://readthedocs.org/api/v3/projects/$PROJECT/versions/master/builds/" \
--header 'Content-Type: application/json' \
--header "Authorization: Token ${{ secrets.READTHEDOCS_TOKEN }}"
189 changes: 189 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
name: "Release"

on:
workflow_dispatch:
inputs:
version:
type: string
description: "Version number to release (e.g., 1.2.3, 1.2.3-rc1, 1.2.0)"
required: true

permissions: write-all

jobs:
safety_check:
runs-on: ubuntu-latest
environment: release
steps:
- name: "Security Check"
uses: Aiko-IT-Systems/[email protected]
with:
whitelisted-github-ids: ${{ vars.ALLOWED_USER_IDS }}
token: ${{ secrets.GITHUB_TOKEN }}

pre_config:
needs: [safety_check]
outputs:
branch_name: ${{ steps.determine_vars.outputs.branch_name }}
is_rc: ${{ steps.determine_vars.outputs.is_rc }}
version: ${{ steps.determine_vars.outputs.version }}
previous_tag: ${{ steps.determine_vars.outputs.previous_tag }}
runs-on: ubuntu-latest
steps:
- name: "Checkout Repository"
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- name: "Determine Push Branch"
id: determine_vars
env:
VERSION: ${{ github.event.inputs.version }}
run: |
echo "version=$VERSION" >> $GITHUB_OUTPUT
PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^)
echo "previous_tag=${PREVIOUS_TAG}" >> $GITHUB_OUTPUT
if [[ $VERSION =~ -rc ]]; then
MAJOR_MINOR_VERSION=$(echo $VERSION | grep -oE '^[0-9]+\.[0-9]+')
echo "branch_name=v${MAJOR_MINOR_VERSION}.x" >> $GITHUB_OUTPUT
echo "is_rc=true" >> $GITHUB_OUTPUT
elif [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
MAJOR_MINOR_VERSION=$(echo $VERSION | grep -oE '^[0-9]+\.[0-9]+')
echo "branch_name=v${MAJOR_MINOR_VERSION}.x" >> $GITHUB_OUTPUT
echo "is_rc=false" >> $GITHUB_OUTPUT
else
MAJOR_MINOR_VERSION=$(echo $VERSION | grep -oE '^[0-9]+\.[0-9]+')
echo "branch_name=v${MAJOR_MINOR_VERSION}.x" >> $GITHUB_OUTPUT
echo "is_rc=false" >> $GITHUB_OUTPUT
fi
lib_release:
needs: [safety_check,pre_config]
runs-on: ubuntu-latest
environment: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: "Checkout Repository"
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- name: "Release Pycord"
id: pycord-release
uses: Aiko-IT-Systems/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
pypi-token: ${{ secrets.PYPI_TOKEN }}
version-branch-name: ${{ needs.pre_config.outputs.branch_name }}
ref: ${{ github.ref_name }}
repository: ${{ github.repository }}
python-version: "3.12"
release-requirements: "requirements/_release.txt"
version: ${{ needs.pre_config.outputs.version }}
is-rc: ${{ needs.pre_config.outputs.is_rc }}
pypi-package: "py-cord"

- name: "Echo release url"
run: echo "${{ steps.pycord-release.outputs.gh-release }}"

docs_release:
runs-on: ubuntu-latest
needs: [lib_release,pre_config]
if: needs.pre_config.outputs.is_rc == 'false' || (needs.pre_config.outputs.is_rc == 'true' && endsWith(needs.pre_config.outputs.version, '.0-rc1'))
environment: release
steps:
- name: "Sync Versions on Read the Docs"
run: |
curl --location --request POST 'https://readthedocs.org/api/v3/projects/pycord/sync-versions/' \
--header 'Content-Type: application/json' \
--header "Authorization: Token ${{ secrets.READTHEDOCS_TOKEN }}"
- name: "Activate and Show Version on Read the Docs"
run: |
VERSION=${{ needs.pre_config.outputs.version }}
MAJOR_MINOR_VERSION=$(echo $VERSION | grep -oE '^[0-9]+\.[0-9]+')
PATCH_VERSION=${VERSION##*.}
if [[ $PATCH_VERSION =~ ^[0-9]+$ ]]; then
DOCS_VERSION="v$VERSION"
else
DOCS_VERSION="v$MAJOR_MINOR_VERSION.x"
fi
curl --location --request PATCH "https://readthedocs.org/api/v3/projects/pycord/versions/$DOCS_VERSION/" \
--header 'Content-Type: application/json' \
--header "Authorization: Token ${{ secrets.READTHEDOCS_TOKEN }}" \
--data '{
"active": true,
"hidden": false
}'
inform_discord:
runs-on: ubuntu-latest
needs: [lib_release,docs_release,close_milestone,pre_config]
environment: release
steps:
- name: "Notify Discord"
run: |
VERSION=${{ needs.pre_config.outputs.version }}
MAJOR_MINOR_VERSION=$(echo $VERSION | grep -oE '^[0-9]+\.[0-9]+')
DOCS_URL="<https://docs.pycord.dev/en/v$VERSION/changelog.html>"
GITHUB_COMPARE_URL="<https://github.com/Pycord-Development/pycord/compare/${{ needs.pre_config.outputs.previous_tag }}...v$VERSION>"
GITHUB_RELEASE_URL="<https://github.com/Pycord-Development/pycord/releases/tag/v$VERSION>"
PYPI_RELEASE_URL="<https://pypi.org/project/py-cord/$VERSION/>"
ANNOUNCEMENT="## <:pycord:1063211537008955495> Pycord v${MAJOR_MINOR_VERSION} is out!\n\n"
ANNOUNCEMENT="${ANNOUNCEMENT}[@everyone]\n\n"
ANNOUNCEMENT="${ANNOUNCEMENT}You can view the changelog here: <$DOCS_URL>\n\n"
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"
ANNOUNCEMENT="${ANNOUNCEMENT}You can install this version by running the following command:\n\`\`\`sh\npip install -U py-cord==$VERSION\n\`\`\`\n\n"
curl -H "Content-Type: application/json" \
-X POST \
-d "{\"content\":\"$ANNOUNCEMENT\"}" \
${{ secrets.DISCORD_WEBHOOK_URL }}
determine_milestone_id:
runs-on: ubuntu-latest
needs: [lib_release,pre_config]
if: ${{ !contains(needs.pre_config.outputs.version, '-') && endsWith(needs.pre_config.outputs.version, '.0') }}
outputs:
old_milestone_version: ${{ steps.extract_version.outputs.old_milestone_version }}
new_milestone_version: ${{ steps.extract_version.outputs.new_milestone_version }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
environment: release
steps:
- name: "Extract Milestone Version"
id: extract_version
run: |
gh extension install valeriobelli/gh-milestone
VERSION=${{ needs.pre_config.outputs.version }}
OLD_MILESTONE_VERSION=$(gh milestone list --query "v2.7" | grep "#" | awk '{print $2}')
NEW_MILESTONE_VERSION="v$(echo $VERSION | grep -oE '^[0-9]+\.[0-9]+')"
echo "old_milestone_version=$OLD_MILESTONE_VERSION" >> $GITHUB_OUTPUT
echo "new_milestone_version=$NEW_MILESTONE_VERSION" >> $GITHUB_OUTPUT
close_milestone:
runs-on: ubuntu-latest
needs: [determine_milestone_id,pre_config]
if: ${{ !contains(needs.pre_config.outputs.version, '-') && endsWith(needs.pre_config.outputs.version, '.0') }}
environment: release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: "Checkout Repository"
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- name: "Close Milestone"
run: |
gh extension install valeriobelli/gh-milestone
OLD_MILESTONE_ID=$(gh milestone list --query "${{ needs.determine_milestone_id.outputs.old_milestone_version }}" | grep "#" | cut -d' ' -f2 | cut -d '#' -f2)
gh milestone edit $OLD_MILESTONE_ID --state closed
- name: "Create New Milestone"
run: |
gh extension install valeriobelli/gh-milestone
gh milestone create "${{ needs.determine_milestone_id.outputs.new_milestone_version }}"
2 changes: 1 addition & 1 deletion .github/workflows/todo-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: "Checkout Repository"
uses: actions/checkout@v4
- name: "Track TODO Action"
uses: ribtoks/[email protected].11-beta
uses: ribtoks/[email protected].12-beta
with:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ docs/changelog.md
# Translations
docs/build/html
docs/build/doctrees
docs/build/linkcheck
!docs/build/locales/*
*.mo
!docs/locales/*
Expand Down
Loading

0 comments on commit 15be560

Please sign in to comment.