@@ -59,13 +59,15 @@ jobs:
5959 submodules : true
6060
6161 - name : Guard non-main branches
62+ env :
63+ INPUT_VERSION : ${{ inputs.version }}
64+ INPUT_BRANCH : ${{ inputs.branch }}
6265 run : |
63- key=$(echo "${{ inputs.version }}" | awk '{print $1}')
64- branch="${{ inputs.branch }}"
65- if [ "$branch" != "main" ]; then
66+ key=$(echo "$INPUT_VERSION" | awk '{print $1}')
67+ if [ "$INPUT_BRANCH" != "main" ]; then
6668 case "$key" in
6769 *-rc|next-rc) ;; # allowed
68- *) echo "::error::Only RC releases are allowed from non-main branches (got '$key' on '$branch ')"; exit 1 ;;
70+ *) echo "::error::Only RC releases are allowed from non-main branches (got '$key' on '$INPUT_BRANCH ')"; exit 1 ;;
6971 esac
7072 fi
7173
7880 run : pip install click packaging
7981
8082 - name : Bump version
83+ env :
84+ INPUT_VERSION : ${{ inputs.version }}
85+ INPUT_PACKAGE : ${{ inputs.package }}
8186 run : |
82- key=$(echo "${{ inputs.version }} " | awk '{print $1}')
83- pkg="${{ inputs.package }} "
87+ key=$(echo "$INPUT_VERSION " | awk '{print $1}')
88+ pkg="$INPUT_PACKAGE "
8489
8590 case "$key" in
8691 patch|minor|major)
@@ -101,12 +106,14 @@ jobs:
101106
102107 - name : Read new version
103108 id : version
109+ env :
110+ INPUT_PACKAGE : ${{ inputs.package }}
104111 run : |
105- pkg="${{ inputs.package }} "
112+ pkg="$INPUT_PACKAGE "
106113 version_file=$(echo '${{ env.VERSION_FILE_MAP }}' | jq -r --arg pkg "$pkg" '.[$pkg]')
107114 version=$(python -c "
108115 import re, pathlib
109- m = re.search(r'__version__\s*=\s*[\"'\''](.*?)[\"'\'']', pathlib.Path('$version_file').read_text())
116+ m = re.search(r'__version__\s*=\s*[\"'\''](.*?)[\"'\'']', pathlib.Path('${ version_file} ').read_text())
110117 print(m.group(1))
111118 ")
112119 tag_prefix=$(echo '${{ env.TAG_PREFIX_MAP }}' | jq -r --arg pkg "$pkg" '.[$pkg]')
@@ -117,8 +124,9 @@ jobs:
117124 - name : Close existing release PRs for this package
118125 env :
119126 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
127+ TAG_PREFIX : ${{ steps.version.outputs.tag_prefix }}
120128 run : |
121- prefix="release/${{ steps.version.outputs.tag_prefix } }-v"
129+ prefix="release/${TAG_PREFIX }-v"
122130 gh pr list --state open --json number,headRefName \
123131 --jq ".[] | select(.headRefName | startswith(\"$prefix\")) | .number" | while read -r pr; do
124132 echo "Superseding release PR #$pr"
@@ -129,23 +137,25 @@ jobs:
129137 - name : Create release PR
130138 env :
131139 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
140+ VERSION : ${{ steps.version.outputs.version }}
141+ TAG_PREFIX : ${{ steps.version.outputs.tag_prefix }}
142+ INPUT_BRANCH : ${{ inputs.branch }}
143+ INPUT_PACKAGE : ${{ inputs.package }}
132144 run : |
133- version="${{ steps.version.outputs.version }}"
134- tag_prefix="${{ steps.version.outputs.tag_prefix }}"
135- branch="release/${tag_prefix}-v${version}"
145+ branch="release/${TAG_PREFIX}-v${VERSION}"
136146
137147 git config user.name "github-actions[bot]"
138148 git config user.email "github-actions[bot]@users.noreply.github.com"
139149 git checkout -b "$branch"
140150 git add -A
141- git commit -m "${tag_prefix }-v${version }"
151+ git commit -m "${TAG_PREFIX }-v${VERSION }"
142152 git push --force origin "$branch"
143153
144154 gh pr create \
145- --base "${{ inputs.branch }} " \
155+ --base "$INPUT_BRANCH " \
146156 --head "$branch" \
147- --title "${{ inputs.package }} v${version }" \
148- --body "Merging this PR will publish **${{ inputs.package }} ** v${version } to PyPI." \
157+ --title "${INPUT_PACKAGE} v${VERSION }" \
158+ --body "Merging this PR will publish **${INPUT_PACKAGE} ** v${VERSION } to PyPI." \
149159 --label "release"
150160
151161 # ── Step 2: Publish on merge ──────────────────────────────────
@@ -162,10 +172,11 @@ jobs:
162172 steps :
163173 - name : Parse release branch
164174 id : detect
175+ env :
176+ HEAD_REF : ${{ github.event.pull_request.head.ref }}
165177 run : |
166- branch="${{ github.event.pull_request.head.ref }}"
167178 # branch is like release/rtc-v1.2.0, release/api-v1.1.1, release/protocol-v1.1.5
168- ref="${branch #release/}"
179+ ref="${HEAD_REF #release/}"
169180 prefix="${ref%%-v*}"
170181
171182 case "$prefix" in
@@ -187,11 +198,13 @@ jobs:
187198 - uses : actions/checkout@v4
188199
189200 - name : Create git tag
201+ env :
202+ TAG : ${{ needs.detect.outputs.tag }}
190203 run : |
191204 git config user.name "github-actions[bot]"
192205 git config user.email "github-actions[bot]@users.noreply.github.com"
193- git tag "${{ needs.detect.outputs.tag }} "
194- git push origin "${{ needs.detect.outputs.tag }} "
206+ git tag "$TAG "
207+ git push origin "$TAG "
195208
196209 # ── RTC builds (multi-platform) ──────────────────────────────
197210 build-rtc :
0 commit comments