Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

[E2B-286] - Run release GHA only when really releasing (#114)

Jakub Nováke894b4958f50
diff --git a/.github/scripts/is_release.sh b/.github/scripts/is_release.sh
new file mode 100755
index 000000000..436d0f077
--- /dev/null
+++ b/.github/scripts/is_release.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# This script checks if the current commit contains changesets.
+
+set -eu
+
+CHANGES=$(node -e "require('@changesets/read').default(process.cwd()).then(result => console.log(!!result.length))")
+
+echo "${CHANGES}"
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 94744ebe3..5a6b3f09e 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -11,7 +11,32 @@ permissions:
contents: write
jobs:
+ is_release:
+ name: Is release?
+ runs-on: ubuntu-latest
+ outputs:
+ release: ${{ steps.version.outputs.release }}
+ steps:
+ - name: Checkout Repo
+ uses: actions/checkout@v3
+
+ - name: Setup Node.js 16
+ uses: actions/setup-node@v3
+ with:
+ node-version: 16
+
+ - name: Install npm dependencies
+ run: npm ci --workspaces=false
+
+ - name: Check if new version
+ id: version
+ run: |
+ IS_RELEASE=$(./.github/scripts/is_release.sh)
+ echo "release=$IS_RELEASE" >> "$GITHUB_OUTPUT"
+
release:
+ needs: [ is_release ]
+ if: needs.is_release.outputs.release == 'true'
name: Release
runs-on: ubuntu-latest
steps:
@@ -23,11 +48,6 @@ jobs:
with:
python-version: "3.11"
- - name: Setup Node.js 16
- uses: actions/setup-node@v3
- with:
- node-version: 16
-
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
@@ -36,6 +56,13 @@ jobs:
virtualenvs-in-project: true
installer-parallel: true
+
+ - name: Setup Node.js 16
+ uses: actions/setup-node@v3
+ with:
+ node-version: 16
+
+
- name: Install dependencies
run: npm ci
diff --git a/package-lock.json b/package-lock.json
index e6571154f..e02b64c39 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -9,7 +9,8 @@
"packages/*"
],
"dependencies": {
- "@changesets/cli": "^2.26.2"
+ "@changesets/cli": "^2.26.2",
+ "@changesets/read": "^0.5.9"
}
},
"apps/dashboard": {
diff --git a/package.json b/package.json
index 7d7a37a09..2f9c7d72a 100644
--- a/package.json
+++ b/package.json
@@ -11,6 +11,7 @@
"packages/*"
],
"dependencies": {
- "@changesets/cli": "^2.26.2"
+ "@changesets/cli": "^2.26.2",
+ "@changesets/read": "^0.5.9"
}
}