Skip to content

Commit

Permalink
chore(actions)!: rework actions (#2547)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lulalaby authored Aug 16, 2024
1 parent e2b5bed commit 26f6ec6
Show file tree
Hide file tree
Showing 14 changed files with 304 additions and 294 deletions.
65 changes: 0 additions & 65 deletions .github/workflows/.cleanup-todo

This file was deleted.

38 changes: 0 additions & 38 deletions .github/workflows/check.yml

This file was deleted.

File renamed without changes.
53 changes: 53 additions & 0 deletions .github/workflows/docs-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: "Documentation Checks"

on:
push:
paths:
- discord/
- docs/
- requirements/
- pyproject.toml
- setup.py
pull_request:
paths:
- discord/
- docs/
- requirements/
- pyproject.toml
- setup.py
workflow_dispatch:
schedule:
- cron: "0 0 * * *"

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions: write-all

jobs:
docs:
runs-on: ubuntu-latest
steps:
- name: "Checkout Repository"
uses: actions/checkout@v4
- name: "Setup Python"
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: "requirements/docs.txt"
check-latest: true
- name: Install dependencies
run: |
python -m pip install -U pip
pip install ".[docs]"
- name: "Check Links"
if: ${{ github.event_name == 'schedule' }}
run: |
cd docs
make linkcheck
- name: "Compile to html"
run: |
cd docs
make -e SPHINXOPTS="-D language='en'" html
30 changes: 15 additions & 15 deletions .github/workflows/docs-localization-download.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
name: Multilingual Docs Download
name: "Multilingual Docs Download"

on:
workflow_dispatch:

permissions: write-all

jobs:
download:
permissions: write-all
name: "Download localizations from Crowdin"
runs-on: ubuntu-latest
outputs:
pr_ref: ${{ steps.convert_outputs.outputs.pr_ref }}
pr_id: ${{ steps.convert_outputs.outputs.pr_id }}
steps:
- name: Checkout Repository
- name: "Checkout Repository"
uses: actions/checkout@v4
with:
fetch-tags: true
Expand All @@ -34,8 +35,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 -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
working-directory: ./docs
- name: "Crowdin"
id: crowdin
Expand All @@ -48,9 +48,7 @@ jobs:
localization_branch_name: l10n_master
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_body: "Crowdin download was triggered due to completely translated file or project. Starting sync. CC @Lulalaby"
pull_request_base_branch_name: "master"
pull_request_reviewers: "Lulalaby"
config: "crowdin.yml"
Expand All @@ -69,14 +67,13 @@ jobs:
echo "pr_id=$(echo -n "$PR_ID" | base64)" >> $GITHUB_OUTPUT
pr:
permissions: write-all
name: "PR operations"
needs: [download]
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
- name: "Checkout Repository"
uses: actions/checkout@v4
- name: Refresh Pull
- name: "Refresh Pull"
run: |
git fetch --all
git reset --hard origin/master
Expand Down Expand Up @@ -123,11 +120,14 @@ jobs:
#with:
#workflow: version-updates.yml
#ref: ${{ steps.convert_outputs.outputs.pr_ref }}
- run: gh pr merge --auto --squash $PR_ID
- name: "Auto Approve"
run: gh pr review --approve -b "auto-approval for localization sync :3" "$PR_ID"
env:
PR_ID: ${{ steps.convert_outputs.outputs.pr_id }}
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }}
- run: gh pr review --approve -b "auto-approval for localization sync :3" "$PR_ID"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Enable Auto Merge"
if: ${{ always() }}
run: gh pr merge --auto --squash $PR_ID
env:
PR_ID: ${{ steps.convert_outputs.outputs.pr_id }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }}
12 changes: 5 additions & 7 deletions .github/workflows/docs-localization-upload.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
name: Multilingual Docs Upload
name: "Multilingual Docs Upload"

on:
push:
branches:
- master
workflow_dispatch:

permissions: write-all

jobs:
upload:
permissions: write-all
name: "Upload localization base to Crowdin"
runs-on: ubuntu-latest
if:
contains(github.event.head_commit.message, '!crowdin upload') || github.event_name
== 'workflow_dispatch'
if: ${{ contains(github.event.head_commit.message, '!crowdin upload') || github.event_name == 'workflow_dispatch' }}
steps:
- uses: actions/checkout@v4
- name: "Install Python"
Expand All @@ -34,8 +33,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 -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
working-directory: ./docs
- name: "Crowdin"
uses: crowdin/github-action@v2
Expand Down
Loading

0 comments on commit 26f6ec6

Please sign in to comment.