Skip to content

Commit 9f7957d

Browse files
authored
Script for per-package check if release is needed (e2b-dev#641)
Inspired by original change in code-interpreter release process e2b-dev/code-interpreter#72
1 parent d032d5a commit 9f7957d

File tree

2 files changed

+55
-28
lines changed

2 files changed

+55
-28
lines changed
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
3+
# This script checks if the specified package has changesets in the current commit.
4+
5+
set -eu
6+
7+
if [ $# -lt 1 ]; then
8+
echo "Error: Package name is required as the first argument." >&2
9+
exit 1
10+
fi
11+
12+
PACKAGE_NAME=$1
13+
PACKAGE_CHANGES=$(node -e "require('@changesets/read').default(process.cwd()).then(result => console.log(result.flatMap(changeset => changeset.releases.flatMap(release => release.name)).includes('${PACKAGE_NAME}')))")
14+
15+
echo "${PACKAGE_CHANGES}"

.github/workflows/release.yml

+40-28
Original file line numberDiff line numberDiff line change
@@ -54,40 +54,52 @@ jobs:
5454
if: needs.is_release.outputs.release == 'true'
5555
runs-on: ubuntu-latest
5656
outputs:
57-
js-sdk: ${{ steps.filter.outputs.js-sdk }}
58-
python-sdk: ${{ steps.filter.outputs.python-sdk }}
59-
cli: ${{ steps.filter.outputs.cli }}
57+
js-sdk: ${{ steps.js.outputs.release }}
58+
python-sdk: ${{ steps.python.outputs.release }}
59+
cli: ${{ steps.cli.outputs.release }}
6060
steps:
61-
- name: Checkout repository
61+
- name: Checkout Repo
6262
uses: actions/checkout@v3
63-
with:
64-
fetch-depth: 0
6563

66-
- name: Get the last release
67-
id: last_release
68-
uses: cardinalby/git-get-release-action@v1
69-
env:
70-
GITHUB_TOKEN: ${{ github.token }}
64+
- name: Install pnpm
65+
uses: pnpm/action-setup@v3
66+
id: pnpm-install
7167
with:
72-
latest: true
73-
prerelease: false
74-
draft: false
68+
version: 9.5
7569

76-
- name: Find changes since the last release
77-
uses: dorny/paths-filter@v2
78-
id: filter
70+
- name: Setup Node
71+
uses: actions/setup-node@v3
7972
with:
80-
base: ${{ steps.last_release.outputs.tag_name }}
81-
filters: |
82-
js-sdk:
83-
- 'packages/js-sdk/src/**'
84-
- '.github/workflows/js_sdk_tests.yml'
85-
python-sdk:
86-
- 'packages/python-sdk/e2b/**'
87-
- '.github/workflows/python_sdk_tests.yml'
88-
cli:
89-
- 'packages/cli/src/**'
90-
- '.github/workflows/cli_tests.yml'
73+
node-version: "18.x"
74+
registry-url: "https://registry.npmjs.org"
75+
cache: pnpm
76+
cache-dependency-path: pnpm-lock.yaml
77+
78+
- name: Configure pnpm
79+
run: |
80+
pnpm config set auto-install-peers true
81+
pnpm config set exclude-links-from-lockfile true
82+
83+
- name: Install dependencies
84+
run: pnpm install --frozen-lockfile
85+
86+
- name: Check JavasScript SDK Release
87+
id: js
88+
run: |
89+
IS_RELEASE=$(./.github/scripts/is_release_for_package.sh "e2b")
90+
echo "release=$IS_RELEASE" >> "$GITHUB_OUTPUT"
91+
92+
- name: Check Python SDK Release
93+
id: python
94+
run: |
95+
IS_RELEASE=$(./.github/scripts/is_release_for_package.sh "@e2b/python-sdk")
96+
echo "release=$IS_RELEASE" >> "$GITHUB_OUTPUT"
97+
98+
- name: Check CLI Release
99+
id: cli
100+
run: |
101+
IS_RELEASE=$(./.github/scripts/is_release_for_package.sh "@e2b/cli")
102+
echo "release=$IS_RELEASE" >> "$GITHUB_OUTPUT"
91103
92104
python-tests:
93105
name: Python SDK Tests

0 commit comments

Comments
 (0)