[llvm] [libclang/python][ci] Add release Clang Python Bindings CI workflow (PR #168234)
Ryan Mast via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 27 12:24:41 PST 2025
================
@@ -0,0 +1,120 @@
+name: Release Clang Python Bindings
+
+permissions:
+ contents: read
+
+on:
+ push:
+ branches:
+ - main
+ - release/*
+ paths:
+ - .github/workflows/release-clang-pypi.yml
+ - 'clang/bindings/python/**'
+
+ pull_request:
+ paths:
+ - .github/workflows/release-clang-pypi.yml
+ - 'clang/bindings/python/**'
+
+ workflow_dispatch:
+ inputs:
+ release-version:
+ description: 'Release Version'
+ required: false
+ type: string
+
+ workflow_call:
+ inputs:
+ release-version:
+ description: 'Release Version'
+ required: true
+ type: string
+ secrets:
+ RELEASE_TASKS_USER_TOKEN:
+ description: "Secret used to check user permissions."
+ required: false
+
+jobs:
+ build-release:
+ if: github.repository_owner == 'llvm' || github.event_name == 'workflow_dispatch'
+ runs-on: ubuntu-24.04
+ steps:
+ - name: Checkout LLVM (tagged release)
+ if: inputs.release-version != ''
+ uses: actions/checkout at 08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+ with:
+ ref: "llvmorg-${{ inputs.release-version }}"
+ fetch-depth: 2
+ sparse-checkout: |
+ clang/bindings/python/
+ llvm/utils/git/requirements_packaging.txt
+
+ - name: Checkout LLVM (latest commit)
+ if: inputs.release-version == ''
+ uses: actions/checkout at 08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+ with:
+ fetch-depth: 0
+ sparse-checkout: |
+ clang/bindings/python/
+ llvm/utils/git/requirements_packaging.txt
+
----------------
nightlark wrote:
For some reason with this change CodeQL decided that it is a checkout of untrusted code in a trusted workflow. I think what I'm going to do is split out the publish job into a separate file, and then when permissions are sorted out for publishing it to PyPI, the release-tasks.yml file can be updated to tie the package build and publish workflows together.
This should ensure that the publish step will only ever run in a trusted context. The separate publishing workflow file could also be used to publish other packages like `lit`, reducing duplication a bit more and giving a clearer separation between the parts that need to run in a trusted context vs okay in an untrusted context.
https://github.com/llvm/llvm-project/pull/168234
More information about the llvm-commits
mailing list