Skip to content

armgit / E2B

Public Imported from GitHub
0

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

ci: split release workflow into production and candidate workflows (#1483)

Mish Ushakov5c8c3ad7fc67
diff --git a/.github/workflows/publish_candidates.yml b/.github/workflows/publish_candidates.yml
index 1c48d632b..ada20a68a 100644
--- a/.github/workflows/publish_candidates.yml
+++ b/.github/workflows/publish_candidates.yml
@@ -86,7 +86,7 @@ jobs:
working-directory: packages/python-sdk
run: |
BASE_VERSION=$(poetry version -s)
- poetry version "${BASE_VERSION}rc${{ github.run_number }}"
+ poetry version "${BASE_VERSION}rc${{ github.run_id }}"
poetry build
poetry config pypi-token.pypi ${PYPI_TOKEN} && poetry publish --skip-existing
env:
@@ -103,7 +103,7 @@ jobs:
RC_PREID: ${{ inputs.preid }}
RC_TAG: ${{ inputs.tag }}
run: |
- npm version prerelease --preid="${RC_PREID}.${{ github.run_number }}" --no-git-tag-version
+ npm version prerelease --preid="${RC_PREID}.${{ github.run_id }}" --no-git-tag-version
npm publish --tag "$RC_TAG" --provenance
- name: Reinstall dependencies
@@ -117,5 +117,5 @@ jobs:
RC_PREID: ${{ inputs.preid }}
RC_TAG: ${{ inputs.tag }}
run: |
- npm version prerelease --preid="${RC_PREID}.${{ github.run_number }}" --no-git-tag-version
+ npm version prerelease --preid="${RC_PREID}.${{ github.run_id }}" --no-git-tag-version
npm publish --tag "$RC_TAG" --provenance
diff --git a/.github/workflows/release-candidate.yml b/.github/workflows/release-candidate.yml
new file mode 100644
index 000000000..c38e544c3
--- /dev/null
+++ b/.github/workflows/release-candidate.yml
@@ -0,0 +1,106 @@
+name: Release candidate
+
+on:
+ workflow_dispatch:
+ inputs:
+ js-sdk:
+ description: 'Release JS SDK'
+ required: false
+ default: false
+ type: boolean
+ python-sdk:
+ description: 'Release Python SDK'
+ required: false
+ default: false
+ type: boolean
+ cli:
+ description: 'Release CLI'
+ required: false
+ default: false
+ type: boolean
+ tag:
+ description: 'Dist-tag (e.g. rc, beta, snapshot)'
+ required: false
+ default: 'rc'
+ type: string
+ preid:
+ description: 'Prerelease identifier (defaults to branch name)'
+ required: false
+ default: ''
+ type: string
+ skip-tests:
+ description: 'Skip tests'
+ required: false
+ default: false
+ type: boolean
+
+# Shared literal group so production and candidate releases on the same ref serialize.
+concurrency: release-${{ github.ref }}
+
+permissions:
+ id-token: write
+ contents: write
+
+jobs:
+ rc-validate:
+ name: Validate RC inputs
+ runs-on: ubuntu-latest
+ outputs:
+ preid: ${{ steps.preid.outputs.preid }}
+ tag: ${{ steps.tag.outputs.tag }}
+ steps:
+ - name: Sanitize tag
+ id: tag
+ env:
+ RAW_TAG: ${{ github.event.inputs.tag }}
+ run: |
+ SAFE_TAG="$(echo "$RAW_TAG" | sed 's/[^0-9A-Za-z-]/-/g')"
+ echo "tag=$SAFE_TAG" >> "$GITHUB_OUTPUT"
+
+ - name: Block production tags
+ run: |
+ if [ "${{ steps.tag.outputs.tag }}" = "latest" ]; then
+ echo "::error::Publishing with the 'latest' tag is not allowed for candidates. Use the 'Release' workflow instead."
+ exit 1
+ fi
+
+ - name: Sanitize preid
+ id: preid
+ env:
+ RAW_PREID: ${{ github.event.inputs.preid || github.ref_name }}
+ run: |
+ echo "preid=$(echo "$RAW_PREID" | sed 's/[^0-9A-Za-z-]/-/g')" >> "$GITHUB_OUTPUT"
+
+ rc-python-tests:
+ name: RC Python Tests
+ needs: [rc-validate]
+ if: github.event.inputs.python-sdk == 'true' && github.event.inputs.skip-tests != 'true'
+ uses: ./.github/workflows/python_sdk_tests.yml
+ secrets: inherit
+
+ rc-js-tests:
+ name: RC JS Tests
+ needs: [rc-validate]
+ if: github.event.inputs.js-sdk == 'true' && github.event.inputs.skip-tests != 'true'
+ uses: ./.github/workflows/js_sdk_tests.yml
+ secrets: inherit
+
+ rc-cli-tests:
+ name: RC CLI Tests
+ needs: [rc-validate]
+ if: github.event.inputs.cli == 'true' && github.event.inputs.skip-tests != 'true'
+ uses: ./.github/workflows/cli_tests.yml
+ secrets: inherit
+
+ rc-publish:
+ name: Publish RC
+ needs: [rc-validate, rc-python-tests, rc-js-tests, rc-cli-tests]
+ if: (!cancelled()) && !contains(needs.*.result, 'failure') && needs.rc-validate.result == 'success'
+ uses: ./.github/workflows/publish_candidates.yml
+ with:
+ js-sdk: ${{ github.event.inputs.js-sdk == 'true' }}
+ python-sdk: ${{ github.event.inputs.python-sdk == 'true' }}
+ cli: ${{ github.event.inputs.cli == 'true' }}
+ tag: ${{ needs.rc-validate.outputs.tag }}
+ preid: ${{ needs.rc-validate.outputs.preid }}
+ secrets: inherit
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index e94858aea..e6444ba19 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,57 +1,18 @@
name: Release
on:
- workflow_dispatch:
- inputs:
- mode:
- description: 'Release mode'
- type: choice
- options:
- - release
- - candidate
- default: release
- js-sdk:
- description: 'Release JS SDK (candidate only)'
- required: false
- default: false
- type: boolean
- python-sdk:
- description: 'Release Python SDK (candidate only)'
- required: false
- default: false
- type: boolean
- cli:
- description: 'Release CLI (candidate only)'
- required: false
- default: false
- type: boolean
- tag:
- description: 'Dist-tag for candidate (e.g. rc, beta, snapshot)'
- required: false
- default: 'rc'
- type: string
- preid:
- description: 'Prerelease identifier (defaults to branch name, candidate only)'
- required: false
- default: ''
- type: string
- skip-tests:
- description: 'Skip tests (candidate only)'
- required: false
- default: false
- type: boolean
+ workflow_dispatch: {}
-concurrency: ${{ github.workflow }}-${{ github.ref }}
+# Shared literal group so production and candidate releases on the same ref serialize.
+concurrency: release-${{ github.ref }}
permissions:
id-token: write
contents: write
jobs:
- # ── Production release ───────────────────────────────────
preflight:
name: Release preflight
- if: github.event.inputs.mode != 'candidate'
runs-on: ubuntu-latest
outputs:
release: ${{ steps.version.outputs.release }}
@@ -219,68 +180,3 @@ jobs:
SLACK_TITLE: Release Succeeded
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: 'monitoring-releases'
-
- # ── Release candidate ────────────────────────────────────
- rc-validate:
- name: Validate RC inputs
- if: github.event.inputs.mode == 'candidate'
- runs-on: ubuntu-latest
- outputs:
- preid: ${{ steps.preid.outputs.preid }}
- tag: ${{ steps.tag.outputs.tag }}
- steps:
- - name: Sanitize tag
- id: tag
- env:
- RAW_TAG: ${{ github.event.inputs.tag }}
- run: |
- SAFE_TAG="$(echo "$RAW_TAG" | sed 's/[^0-9A-Za-z-]/-/g')"
- echo "tag=$SAFE_TAG" >> "$GITHUB_OUTPUT"
-
- - name: Block production tags
- run: |
- if [ "${{ steps.tag.outputs.tag }}" = "latest" ]; then
- echo "::error::Publishing with the 'latest' tag is not allowed for candidates. Use 'release' mode instead."
- exit 1
- fi
-
- - name: Sanitize preid
- id: preid
- env:
- RAW_PREID: ${{ github.event.inputs.preid || github.ref_name }}
- run: |
- echo "preid=$(echo "$RAW_PREID" | sed 's/[^0-9A-Za-z-]/-/g')" >> "$GITHUB_OUTPUT"
-
- rc-python-tests:
- name: RC Python Tests
- needs: [rc-validate]
- if: github.event.inputs.python-sdk == 'true' && github.event.inputs.skip-tests != 'true'
- uses: ./.github/workflows/python_sdk_tests.yml
- secrets: inherit
-
- rc-js-tests:
- name: RC JS Tests
- needs: [rc-validate]
- if: github.event.inputs.js-sdk == 'true' && github.event.inputs.skip-tests != 'true'
- uses: ./.github/workflows/js_sdk_tests.yml
- secrets: inherit
-
- rc-cli-tests:
- name: RC CLI Tests
- needs: [rc-validate]
- if: github.event.inputs.cli == 'true' && github.event.inputs.skip-tests != 'true'
- uses: ./.github/workflows/cli_tests.yml
- secrets: inherit
-
- rc-publish:
- name: Publish RC
- needs: [rc-validate, rc-python-tests, rc-js-tests, rc-cli-tests]
- if: (!cancelled()) && !contains(needs.*.result, 'failure') && needs.rc-validate.result == 'success'
- uses: ./.github/workflows/publish_candidates.yml
- with:
- js-sdk: ${{ github.event.inputs.js-sdk == 'true' }}
- python-sdk: ${{ github.event.inputs.python-sdk == 'true' }}
- cli: ${{ github.event.inputs.cli == 'true' }}
- tag: ${{ needs.rc-validate.outputs.tag }}
- preid: ${{ needs.rc-validate.outputs.preid }}
- secrets: inherit