|
name: update and build |
|
|
|
on: |
|
schedule: |
|
- cron: 0 * * * * |
|
push: |
|
branches: ['*'] |
|
workflow_dispatch: |
|
|
|
permissions: {} |
|
|
|
jobs: |
|
update: |
|
runs-on: ubuntu-latest |
|
strategy: |
|
fail-fast: false |
|
matrix: |
|
version: [3.15, 3.14, 3.13, 3.12, 3.11, '3.10'] |
|
permissions: |
|
contents: write # commit and push |
|
steps: |
|
- uses: styfle/cancel-workflow-action@d07a454dad7609a92316b57b23c9ccfd4f59af66 # 0.13.1 |
|
with: |
|
access_token: ${{ secrets.GITHUB_TOKEN }} |
|
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 |
|
with: |
|
python-version: 3 |
|
- name: Install dependencies |
|
run: | |
|
sudo apt-get install -y gettext |
|
pip install requests cogapp polib transifex-python sphinx-intl blurb six |
|
curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash |
|
working-directory: /usr/local/bin |
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
|
with: |
|
ref: ${{ matrix.version }} |
|
fetch-depth: 0 |
|
persist-credentials: false |
|
- name: Recreate Transifex config |
|
run: ./manage_translation.py recreate_tx_config |
|
env: |
|
TX_TOKEN: ${{ secrets.TX_TOKEN }} |
|
- name: Fetch translations |
|
run: ./manage_translation.py fetch |
|
env: |
|
TX_TOKEN: ${{ secrets.TX_TOKEN }} |
|
- name: Update README.md |
|
run: python -Werror -m cogapp -rP README.md |
|
if: ${{ hashFiles('README.md') != '' }} |
|
env: |
|
TX_TOKEN: ${{ secrets.TX_TOKEN }} |
|
- name: Update README.en.md |
|
run: python -Werror -m cogapp -rP README.en.md |
|
if: ${{ hashFiles('README.en.md') != '' }} |
|
env: |
|
TX_TOKEN: ${{ secrets.TX_TOKEN }} |
|
- run: git config --local user.email github-actions@github.com |
|
- run: git config --local user.name "GitHub Action's update-translation job" |
|
- name: Check changes significance |
|
run: > |
|
! git diff -I'^"POT-Creation-Date: ' -I'^"Language-Team: ' -I'^# ' -I'^"Last-Translator: |
|
' -I'^"Project-Id-Version: ' --exit-code && echo "SIGNIFICANT_CHANGES=1" >> "$GITHUB_ENV" |
|
|| exit 0 |
|
- run: git add . |
|
- run: git commit -m "$(python manage_translation.py generate_commit_msg)" |
|
if: env.SIGNIFICANT_CHANGES |
|
- name: Push commit |
|
uses: ad-m/github-push-action@881a6320fdb16eb5318c5054f31c218aec2b324c # v1.3.0 |
|
if: env.SIGNIFICANT_CHANGES && (github.event_name == 'schedule' || github.ref_name |
|
== github.event.repository.default_branch) |
|
with: |
|
branch: ${{ matrix.version }} |
|
github_token: ${{ secrets.GITHUB_TOKEN }} |
|
|
|
build: |
|
runs-on: ubuntu-latest |
|
strategy: |
|
fail-fast: false |
|
matrix: |
|
version: [3.15, 3.14, 3.13, 3.12, 3.11, '3.10'] |
|
format: [html, latex, epub] |
|
needs: [update] |
|
steps: |
|
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 |
|
with: |
|
python-version: 3 |
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
|
with: |
|
repository: python/cpython |
|
ref: ${{ matrix.version }} |
|
persist-credentials: false |
|
- run: make venv |
|
working-directory: ./Doc |
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
|
with: |
|
ref: ${{ matrix.version }} |
|
path: Doc/locales/pl/LC_MESSAGES |
|
persist-credentials: false |
|
- run: git pull |
|
working-directory: ./Doc/locales/pl/LC_MESSAGES |
|
- run: sudo apt-get update && sudo apt-get install -y librsvg2-bin |
|
if: ${{ matrix.format == 'latex' && fromJSON(matrix.version) >= 3.14 }} |
|
- uses: sphinx-doc/github-problem-matcher@1f74d6599f4a5e89a20d3c99aab4e6a70f7bda0f # v1.1 |
|
- run: make -e SPHINXOPTS="--color -D language='pl'" ${{ matrix.format }} |
|
working-directory: ./Doc |
|
env: |
|
SPHINXERRORHANDLING: '' |
|
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
|
if: success() || failure() |
|
with: |
|
name: build-${{ matrix.version }}-${{ matrix.format }} |
|
path: Doc/build/${{ matrix.format }} |
|
|
|
output-pdf: |
|
runs-on: ubuntu-latest |
|
strategy: |
|
fail-fast: false |
|
matrix: |
|
version: [3.15, 3.14, 3.13, 3.12, 3.11, '3.10'] |
|
needs: [build] |
|
steps: |
|
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 |
|
with: |
|
name: build-${{ matrix.version }}-latex |
|
- run: sudo apt-get update |
|
- run: sudo apt-get install -y latexmk texlive-xetex fonts-freefont-otf xindy |
|
- run: make |
|
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
|
with: |
|
name: build-${{ matrix.version }}-pdf |
|
path: . |