|
| 1 | +name: Update Transifex Config |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +jobs: |
| 7 | + update-config: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + strategy: |
| 10 | + matrix: |
| 11 | + version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.15"] |
| 12 | + include: |
| 13 | + - version: "3.10" |
| 14 | + tx_project: "python-310" |
| 15 | + - version: "3.11" |
| 16 | + tx_project: "python-311" |
| 17 | + - version: "3.12" |
| 18 | + tx_project: "python-312" |
| 19 | + - version: "3.13" |
| 20 | + tx_project: "python-313" |
| 21 | + - version: "3.14" |
| 22 | + tx_project: "python-314" |
| 23 | + - version: "3.15" |
| 24 | + tx_project: "python-newest" |
| 25 | + steps: |
| 26 | + - name: Checkout repository at version branch |
| 27 | + uses: actions/checkout@v4 |
| 28 | + with: |
| 29 | + ref: ${{ matrix.version }} |
| 30 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 31 | + |
| 32 | + - name: Checkout CPython |
| 33 | + uses: actions/checkout@v4 |
| 34 | + with: |
| 35 | + repository: 'python/cpython' |
| 36 | + ref: ${{ matrix.version }} |
| 37 | + path: cpython |
| 38 | + |
| 39 | + - name: Set up Python |
| 40 | + uses: actions/setup-python@v4 |
| 41 | + with: |
| 42 | + python-version: '3.14' |
| 43 | + |
| 44 | + - name: Install Transifex CLI |
| 45 | + run: | |
| 46 | + mkdir -p /tmp |
| 47 | + curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash |
| 48 | + sudo mv ~/bin/tx /usr/local/bin/tx |
| 49 | +
|
| 50 | + - name: Generate Transifex config |
| 51 | + run: | |
| 52 | + python .github/scripts/generate_tx_config.py \ |
| 53 | + --project-name "${{ matrix.tx_project }}" \ |
| 54 | + --doc-path "./cpython/Doc" |
| 55 | + env: |
| 56 | + TX_TOKEN: ${{ secrets.TRANSIFEX_APIKEY }} |
| 57 | + |
| 58 | + - name: Check for changes |
| 59 | + id: check_changes |
| 60 | + run: | |
| 61 | + if git diff --quiet .tx/config; then |
| 62 | + echo "has_changes=false" >> $GITHUB_OUTPUT |
| 63 | + else |
| 64 | + echo "has_changes=true" >> $GITHUB_OUTPUT |
| 65 | + fi |
| 66 | +
|
| 67 | + - name: Configure git |
| 68 | + if: steps.check_changes.outputs.has_changes == 'true' |
| 69 | + run: | |
| 70 | + git config user.name "github-actions[bot]" |
| 71 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 72 | +
|
| 73 | + - name: Commit and push changes |
| 74 | + if: steps.check_changes.outputs.has_changes == 'true' |
| 75 | + run: | |
| 76 | + git add .tx/config |
| 77 | + git commit -m "chore: update Transifex config for Python ${{ matrix.version }}" |
| 78 | + git push |
0 commit comments