Skip to content

ci: publish releases from the deployment GitHub environment - #1850

Merged
mishushakov merged 1 commit into
mainfrom
devin/1788948545-release-environment
Sep 9, 2026
Merged

ci: publish releases from the deployment GitHub environment#1850
mishushakov merged 1 commit into
mainfrom
devin/1788948545-release-environment

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

Runs the production publish job inside a GitHub environment so that the environment's deployment branch policy — not only the Check the ref preflight step — decides which refs may publish latest to npm and PyPI.

# .github/workflows/publish_packages.yml
jobs:
  test:
    runs-on: ubuntu-22.04
+   environment: deployment

It lives on the job in publish_packages.yml, not on publish: in release.yml, because a job that uses: a reusable workflow only accepts name/uses/with/secrets/strategy/needs/if/concurrency/permissions (docs). The preflight ref check stays: it fails fast before the SDK test matrix runs, whereas the environment rule only rejects the publish job itself.

release-candidate.yml / publish_candidates.yml are intentionally left without an environment — candidates are cut from feature branches, which a main-only policy would block.

Required repository configuration

The deployment environment doesn't exist yet (GitHub would auto-create it on first run with no rules). The Devin GitHub App has no admin on this repo, so an admin needs to create it and restrict it to main:

gh api -X PUT repos/e2b-dev/E2B/environments/deployment \
  --input - <<'EOF'
{"deployment_branch_policy":{"protected_branches":false,"custom_branch_policies":true}}
EOF
gh api -X POST repos/e2b-dev/E2B/environments/deployment/deployment-branch-policies \
  -f name=main -f type=branch

Or in the UI: Settings → Environments → New environment deployment → Deployment branches and tags → Selected branches and tags → add main.

No trusted-publisher change is needed: the PyPI publishers from #1828 and the npm publishers were registered with an empty environment, which matches any environment. Optionally tighten them afterwards by setting the environment to deployment on the publish_packages.yml publishers (leave the publish_candidates.yml ones empty).

Link to Devin session: https://app.devin.ai/sessions/a59b5e364c484ced9524a652f80a49f9
Open in Devin Desktop: https://app.devin.ai/desktop/session/a59b5e364c484ced9524a652f80a49f9?variant=devin
Requested by: @mishushakov

Co-Authored-By: mish@e2b.dev <mish@e2b.dev>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@changeset-bot

changeset-bot Bot commented Sep 9, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 3d0a5ad

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@cla-bot cla-bot Bot added the cla-signed label Sep 9, 2026
@mishushakov
mishushakov marked this pull request as ready for review September 9, 2026 10:10
@mishushakov
mishushakov self-requested a review as a code owner September 9, 2026 10:10

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TASTE.md compliance review: this PR only touches .github/workflows/publish_packages.yml (adds environment: deployment to the test job) and changes no SDK or CLI code, so none of the TASTE.md principles (T-1 – T-58: parity, API shape, streaming, control plane, template builder, timeouts, configuration, module structure, errors) apply. 0 violations.

@mishushakov
mishushakov enabled auto-merge (squash) September 9, 2026 10:10
@mishushakov
mishushakov merged commit 8b75907 into main Sep 9, 2026
31 of 32 checks passed
@mishushakov
mishushakov deleted the devin/1788948545-release-environment branch September 9, 2026 10:10
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Package Artifacts

Built from 85fa574. Download artifacts from this workflow run.

JS SDK (e2b@2.47.1-devin-1788948545-release-environment.0):

npm install ./e2b-2.47.1-devin-1788948545-release-environment.0.tgz

CLI (@e2b/cli@2.18.2-devin-1788948545-release-environment.0):

npm install ./e2b-cli-2.18.2-devin-1788948545-release-environment.0.tgz

Code Interpreter JS SDK (@e2b/code-interpreter@2.8.1-devin-1788948545-release-environment.0):

npm install ./e2b-code-interpreter-2.8.1-devin-1788948545-release-environment.0.tgz

Desktop JS SDK (@e2b/desktop@2.4.1-devin-1788948545-release-environment.0):

npm install ./e2b-desktop-2.4.1-devin-1788948545-release-environment.0.tgz

Python SDK (e2b==2.47.0+devin.1788948545.release.environment):

pip install ./e2b-2.47.0+devin.1788948545.release.environment-py3-none-any.whl

Code Interpreter Python SDK (e2b-code-interpreter==2.10.0+devin.1788948545.release.environment):

pip install ./e2b_code_interpreter-2.10.0+devin.1788948545.release.environment-py3-none-any.whl

Desktop Python SDK (e2b-desktop==2.5.0+devin.1788948545.release.environment):

pip install ./e2b_desktop-2.5.0+devin.1788948545.release.environment-py3-none-any.whl

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, straightforward CI config change.

What was reviewed: the single-line addition of environment: deployment to the test job in .github/workflows/publish_packages.yml, the placement rationale (can't go on the reusable-workflow-calling publish job in release.yml), and the rest of the job's publish/tag/push steps for any interaction with the new key. Checked whether the OIDC environment claim this introduces conflicts with existing npm/PyPI trusted-publisher config — ruled out, since those publishers were registered with an empty environment which matches any value. Also confirmed release-candidate.yml/publish_candidates.yml are correctly left untouched, consistent with candidates being cut from non-main branches.

Extended reasoning...

Overview

The diff is a single-line, well-commented addition to .github/workflows/publish_packages.yml: it adds environment: deployment to the test job (the "Build and test SDK" job that ultimately performs the publish/tag/push steps). The comment explains the placement rationale (a job that uses: a reusable workflow can't carry an environment key, so it can't live on publish in release.yml). No SDK source code, spec files, or public package surfaces are touched.

Security risks

This is a release-pipeline hardening change: it ties publish eligibility to a GitHub Environment whose deployment-branch policy can restrict runs to main. The change itself introduces no new secrets handling or auth logic; it layers an additional gate on top of the existing preflight ref-check. The two considerations raised and ruled out this run — that the new environment claim could interact with npm/PyPI trusted-publisher OIDC config, and that the guard is inert until an admin manually creates the deployment environment — are both accurately disclosed in the PR's own "Required repository configuration" section, and neither represents a code defect; they are external repo-configuration follow-ups, not bugs in this diff.

Level of scrutiny

Given the change is a single line plus a comment, confined to a CI/CD workflow file, mechanical, and does not alter build/test/publish logic paths for SDK packages, a lighter-touch review is appropriate. The bug hunting system found no issues, and the two candidates it considered were adequately explained by the PR description itself.

Other factors

No CODEOWNERS restriction applies to .github/workflows/, and the PR timeline shows no outstanding CHANGES_REQUESTED review or unaddressed third-party objection — only the author's own commit and automated bot comments. As a workflow-only change with no impact on packages/cli, packages/js-sdk, or packages/python-sdk public surfaces, it does not require a changeset per CLAUDE.md.

mishushakov added a commit that referenced this pull request Sep 9, 2026
## Summary

Deletes `release-candidate.yml` and the `publish_candidates.yml`
reusable workflow it called. Neither has been run since the candidate
flow was split out of `release.yml` in #1483 (2026-06-25); the last RC
published through the old combined workflow was
`e2b@2.24.1-connections.1189.0` on 2026-05-26, and the last PyPI RC was
`e2b==2.0.0rc2` (2025-08).

`release.yml` keeps its `release-${{ github.ref }}` concurrency group
and the main-only preflight check; only the comments pointing at the
candidate workflow are dropped. `publish_packages.yml` (now running in
the `deployment` environment, #1850) is unaffected.

## Follow-up (PyPI)

The trusted publishers registered for `publish_candidates.yml` on the
`e2b`, `e2b-code-interpreter` and `e2b-desktop` PyPI projects (see
#1828) no longer have a workflow behind them and can be removed. Since
the remaining `publish_packages.yml` publishers are now the only ones,
they can also be tightened to require the `deployment` environment.


Link to Devin session:
https://app.devin.ai/sessions/a59b5e364c484ced9524a652f80a49f9
Open in Devin Desktop:
https://app.devin.ai/desktop/session/a59b5e364c484ced9524a652f80a49f9?variant=devin
Requested by: @mishushakov

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: mish@e2b.dev <mish@e2b.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant