Skip to content

Commit f185b31

Browse files
committedOct 22, 2024
Move publishing to separate workflow
1 parent ee4f850 commit f185b31

File tree

2 files changed

+92
-67
lines changed

2 files changed

+92
-67
lines changed
 

Diff for: ‎.github/workflows/publish_packages.yml

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Test JS SDK
2+
3+
on:
4+
workflow_call:
5+
secrets:
6+
E2B_API_KEY:
7+
required: true
8+
GITHUB_TOKEN:
9+
required: true
10+
NPM_TOKEN:
11+
required: true
12+
PYPI_TOKEN:
13+
required: true
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
test:
20+
defaults:
21+
run:
22+
working-directory: ./packages/js-sdk
23+
name: Build and test SDK
24+
runs-on: ubuntu-20.04
25+
steps:
26+
- name: Checkout Repo
27+
uses: actions/checkout@v3
28+
29+
- name: Set up Python
30+
uses: actions/setup-python@v4
31+
with:
32+
python-version: "3.9"
33+
34+
- name: Install and configure Poetry
35+
uses: snok/install-poetry@v1
36+
with:
37+
version: 1.5.1
38+
virtualenvs-create: true
39+
virtualenvs-in-project: true
40+
installer-parallel: true
41+
42+
- uses: pnpm/action-setup@v3
43+
with:
44+
version: 9.5
45+
46+
- name: Setup Node.js 18
47+
uses: actions/setup-node@v3
48+
with:
49+
node-version: '18.x'
50+
cache: pnpm
51+
52+
- name: Configure pnpm
53+
run: |
54+
pnpm config set auto-install-peers true
55+
pnpm config set exclude-links-from-lockfile true
56+
57+
- name: Install dependencies
58+
run: pnpm install --frozen-lockfile
59+
60+
- name: Create new versions
61+
run: pnpm run version
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
65+
- name: Release new versions
66+
uses: changesets/action@v1
67+
with:
68+
publish: pnpm run publish
69+
createGithubReleases: true
70+
env:
71+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
73+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
74+
75+
- name: Generate API Ref
76+
run: pnpm run generate-api-reference
77+
78+
- name: Update lock file
79+
run: pnpm i --no-link --no-frozen-lockfile
80+
81+
- name: Commit new versions
82+
run: |
83+
git config user.name "github-actions[bot]"
84+
git config user.email "github-actions[bot]@users.noreply.github.com"
85+
git add apps/web/src/app/\(docs\)/docs/api-reference
86+
git commit -am "[skip ci] Release new versions" || exit 0
87+
git push
88+
env:
89+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Diff for: ‎.github/workflows/release.yml renamed to ‎.github/workflows/release_pipeline.yml

+3-67
Original file line numberDiff line numberDiff line change
@@ -111,75 +111,11 @@ jobs:
111111
secrets: inherit
112112

113113
release:
114+
name: Release
114115
needs: [is_release, python-tests, js-tests, cli-tests]
115116
if: !contains(needs.*.result, 'failure') && !cancelled() && needs.is_release.outputs.release == 'true'
116-
name: Release
117-
runs-on: ubuntu-latest
118-
steps:
119-
- name: Checkout Repo
120-
uses: actions/checkout@v3
121-
122-
- name: Set up Python
123-
uses: actions/setup-python@v4
124-
with:
125-
python-version: "3.9"
126-
127-
- name: Install and configure Poetry
128-
uses: snok/install-poetry@v1
129-
with:
130-
version: 1.5.1
131-
virtualenvs-create: true
132-
virtualenvs-in-project: true
133-
installer-parallel: true
134-
135-
- uses: pnpm/action-setup@v3
136-
with:
137-
version: 9.5
138-
139-
- name: Setup Node.js 18
140-
uses: actions/setup-node@v3
141-
with:
142-
node-version: '18.x'
143-
cache: pnpm
144-
145-
- name: Configure pnpm
146-
run: |
147-
pnpm config set auto-install-peers true
148-
pnpm config set exclude-links-from-lockfile true
149-
150-
- name: Install dependencies
151-
run: pnpm install --frozen-lockfile
152-
153-
- name: Create new versions
154-
run: pnpm run version
155-
env:
156-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
157-
158-
- name: Release new versions
159-
uses: changesets/action@v1
160-
with:
161-
publish: pnpm run publish
162-
createGithubReleases: true
163-
env:
164-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
165-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
166-
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
167-
168-
- name: Generate API Ref
169-
run: pnpm run generate-api-reference
170-
171-
- name: Update lock file
172-
run: pnpm i --no-link --no-frozen-lockfile
173-
174-
- name: Commit new versions
175-
run: |
176-
git config user.name "github-actions[bot]"
177-
git config user.email "github-actions[bot]@users.noreply.github.com"
178-
git add apps/web/src/app/\(docs\)/docs/api-reference
179-
git commit -am "[skip ci] Release new versions" || exit 0
180-
git push
181-
env:
182-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
117+
uses: ./.github/workflows/publish_packages.yml
118+
secrets: inherit
183119

184120
report-failure:
185121
needs: [python-tests, js-tests, cli-tests, release]

0 commit comments

Comments
 (0)