Skip to content

Commit 870e4c6

Browse files
authored
script for per-package checkin if release is needed (#72)
1 parent 0d7e24f commit 870e4c6

File tree

2 files changed

+62
-30
lines changed

2 files changed

+62
-30
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

+47-30
Original file line numberDiff line numberDiff line change
@@ -54,42 +54,59 @@ jobs:
5454
if: needs.is_release.outputs.release == 'true'
5555
runs-on: ubuntu-latest
5656
outputs:
57-
js: ${{ steps.filter.outputs.js }}
58-
python: ${{ steps.filter.outputs.python }}
59-
charts: ${{ steps.filter.outputs.charts }}
60-
template: ${{ steps.filter.outputs.template }}
57+
js: ${{ steps.js.outputs.release }}
58+
python: ${{ steps.python.outputs.release }}
59+
charts: ${{ steps.charts.outputs.release }}
60+
template: ${{ steps.template.outputs.release }}
6161
steps:
62-
- name: Checkout repository
62+
- name: Checkout Repo
6363
uses: actions/checkout@v3
64-
with:
65-
fetch-depth: 0
6664

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

77-
- name: Find changes since the last release
78-
uses: dorny/[email protected]
79-
id: filter
71+
- name: Setup Node
72+
uses: actions/setup-node@v3
8073
with:
81-
base: ${{ steps.last_release.outputs.tag_name }}
82-
predicate-quantifier: 'every'
83-
filters: |
84-
js:
85-
- 'js/src/**'
86-
python:
87-
- 'python/e2b_code_interpreter/**'
88-
charts:
89-
- 'chart_data_extractor/e2b_charts/**'
90-
template:
91-
- 'template/**'
92-
- '!template/package.json'
74+
node-version: "18.x"
75+
registry-url: "https://registry.npmjs.org"
76+
cache: pnpm
77+
cache-dependency-path: pnpm-lock.yaml
78+
79+
- name: Configure pnpm
80+
run: |
81+
pnpm config set auto-install-peers true
82+
pnpm config set exclude-links-from-lockfile true
83+
84+
- name: Install dependencies
85+
run: pnpm install --frozen-lockfile
86+
87+
- name: Check JavasScript SDK Release
88+
id: js
89+
run: |
90+
IS_RELEASE=$(./.github/scripts/is_release_for_package.sh "@e2b/code-interpreter")
91+
echo "release=$IS_RELEASE" >> "$GITHUB_OUTPUT"
92+
93+
- name: Check Python SDK Release
94+
id: python
95+
run: |
96+
IS_RELEASE=$(./.github/scripts/is_release_for_package.sh "@e2b/code-interpreter-python")
97+
echo "release=$IS_RELEASE" >> "$GITHUB_OUTPUT"
98+
99+
- name: Check Charts SDK Release
100+
id: charts
101+
run: |
102+
IS_RELEASE=$(./.github/scripts/is_release_for_package.sh "@e2b/data-extractor")
103+
echo "release=$IS_RELEASE" >> "$GITHUB_OUTPUT"
104+
105+
- name: Check Template SDK Release
106+
id: template
107+
run: |
108+
IS_RELEASE=$(./.github/scripts/is_release_for_package.sh "@e2b/code-interpreter-template")
109+
echo "release=$IS_RELEASE" >> "$GITHUB_OUTPUT"
93110
94111
charts-tests:
95112
name: Charts tests

0 commit comments

Comments
 (0)