Skip to content

Commit e0baaca

Browse files
authored
ci: move bindings publish steps to release workflow (#743)
* refactor: move bindings publish steps to release workflow - Remove publish parameter and job from reusable workflows - Add dedicated publish jobs in release.yml for PyPI and npm - This avoids PyPI restrictions on publishing from reusable workflows
1 parent d661b11 commit e0baaca

File tree

4 files changed

+66
-89
lines changed

4 files changed

+66
-89
lines changed

.github/workflows/bindings.nodejs.yml

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@ name: Bindings Node.js
22

33
on:
44
workflow_call:
5-
inputs:
6-
publish:
7-
description: 'Whether to publish to npm'
8-
type: boolean
9-
required: false
10-
default: false
115

126
jobs:
137
check:
@@ -118,49 +112,3 @@ jobs:
118112
name: bindings-nodejs-x86_64-unknown-linux-gnu
119113
path: bindings/nodejs
120114
- run: make -C tests test-bindings-nodejs
121-
122-
publish:
123-
if: inputs.publish == true
124-
needs: [build, integration]
125-
runs-on: ubuntu-latest
126-
permissions:
127-
contents: write
128-
id-token: write
129-
environment:
130-
name: npmjs.com
131-
url: https://www.npmjs.com/package/databend-driver
132-
steps:
133-
- uses: actions/checkout@v4
134-
- name: Setup node
135-
uses: actions/setup-node@v4
136-
with:
137-
node-version: "22"
138-
- name: Corepack
139-
working-directory: bindings/nodejs
140-
run: npm i -g --force corepack && corepack enable
141-
- name: Install dependencies
142-
working-directory: bindings/nodejs
143-
run: pnpm install
144-
- name: Download all artifacts
145-
uses: actions/download-artifact@v4
146-
with:
147-
path: bindings/nodejs/artifacts
148-
pattern: bindings-nodejs-*
149-
merge-multiple: true
150-
- name: Move artifacts
151-
shell: bash
152-
working-directory: bindings/nodejs
153-
run: |
154-
ls -lRh artifacts
155-
pnpm napi artifacts
156-
ls -lRh npm
157-
- name: Add LICENSE
158-
run: cp LICENSE ./bindings/nodejs
159-
- name: Publish
160-
working-directory: bindings/nodejs
161-
env:
162-
GITHUB_TOKEN: ${{ github.token }}
163-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
164-
run: |
165-
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
166-
npm publish --access public --provenance

.github/workflows/bindings.python.yml

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@ name: Bindings Python
22

33
on:
44
workflow_call:
5-
inputs:
6-
publish:
7-
description: 'Whether to publish to PyPI'
8-
type: boolean
9-
required: false
10-
default: false
115

126
jobs:
137
check:
@@ -194,26 +188,3 @@ jobs:
194188
path: bindings/python/dist
195189
- name: Run Nox
196190
run: nox -f tests/nox/noxfile.py
197-
198-
199-
publish:
200-
if: inputs.publish == true
201-
needs: [check, build, integration]
202-
runs-on: ubuntu-latest
203-
permissions:
204-
id-token: write
205-
environment:
206-
name: pypi.org
207-
url: https://pypi.org/p/databend-driver/
208-
steps:
209-
- uses: actions/checkout@v4
210-
- uses: actions/download-artifact@v4
211-
with:
212-
path: bindings/python/artifacts
213-
pattern: bindings-python-*
214-
merge-multiple: true
215-
- name: Publish package distributions to PyPI
216-
uses: pypa/gh-action-pypi-publish@unstable/v1
217-
with:
218-
skip-existing: true
219-
packages-dir: bindings/python/artifacts

.github/workflows/ci.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,9 @@ jobs:
9393
bindings_python:
9494
needs: check
9595
uses: ./.github/workflows/bindings.python.yml
96-
with:
97-
publish: false
9896
secrets: inherit
9997

10098
bindings_nodejs:
10199
needs: check
102100
uses: ./.github/workflows/bindings.nodejs.yml
103-
with:
104-
publish: false
105101
secrets: inherit

.github/workflows/release.yml

Lines changed: 66 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,14 +249,76 @@ jobs:
249249
needs: [check, build_linux]
250250
if: needs.check.outputs.version_changed == 'true'
251251
uses: ./.github/workflows/bindings.python.yml
252-
with:
253-
publish: true
254252
secrets: inherit
255253

254+
bindings_python_publish:
255+
needs: bindings_python
256+
runs-on: ubuntu-latest
257+
permissions:
258+
id-token: write
259+
environment:
260+
name: pypi.org
261+
url: https://pypi.org/p/databend-driver/
262+
steps:
263+
- uses: actions/checkout@v4
264+
- uses: actions/download-artifact@v4
265+
with:
266+
path: bindings/python/artifacts
267+
pattern: bindings-python-*
268+
merge-multiple: true
269+
- name: Publish package distributions to PyPI
270+
uses: pypa/gh-action-pypi-publish@unstable/v1
271+
with:
272+
skip-existing: true
273+
packages-dir: bindings/python/artifacts
274+
256275
bindings_nodejs:
257276
needs: [check, build_linux]
258277
if: needs.check.outputs.version_changed == 'true'
259278
uses: ./.github/workflows/bindings.nodejs.yml
260-
with:
261-
publish: true
262279
secrets: inherit
280+
281+
bindings_nodejs_publish:
282+
needs: bindings_nodejs
283+
runs-on: ubuntu-latest
284+
permissions:
285+
contents: write
286+
id-token: write
287+
environment:
288+
name: npmjs.com
289+
url: https://www.npmjs.com/package/databend-driver
290+
steps:
291+
- uses: actions/checkout@v4
292+
- name: Setup node
293+
uses: actions/setup-node@v4
294+
with:
295+
node-version: "22"
296+
- name: Corepack
297+
working-directory: bindings/nodejs
298+
run: npm i -g --force corepack && corepack enable
299+
- name: Install dependencies
300+
working-directory: bindings/nodejs
301+
run: pnpm install
302+
- name: Download all artifacts
303+
uses: actions/download-artifact@v4
304+
with:
305+
path: bindings/nodejs/artifacts
306+
pattern: bindings-nodejs-*
307+
merge-multiple: true
308+
- name: Move artifacts
309+
shell: bash
310+
working-directory: bindings/nodejs
311+
run: |
312+
ls -lRh artifacts
313+
pnpm napi artifacts
314+
ls -lRh npm
315+
- name: Add LICENSE
316+
run: cp LICENSE ./bindings/nodejs
317+
- name: Publish
318+
working-directory: bindings/nodejs
319+
env:
320+
GITHUB_TOKEN: ${{ github.token }}
321+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
322+
run: |
323+
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
324+
npm publish --access public --provenance

0 commit comments

Comments
 (0)