Skip to content

Automated releases #1114

Closed
Closed

Description

@matejchalk

Motivation

Our current release process is for a core maintainer to run npx nx release --yes in main branch (requires npm login and GITHUB_TOKEN in .env).

We've previously spent quite a lot of effort in releasing via GitHub Actions, but never quite got it working reliably. A partially broken release is complex to recover from, so running a command locally proved to be more practical.

But our current release process relies too much on one person, and doesn't allow us to secure npm publishing via provenance or trusted publishing.

Acceptance criteria

  • run nx release on push to main branch
    • release is skipped if no user-facing commits (feat, fix, perf) were pushed
  • GitHub Actions is configured as a trusted publisher
    • no long-lived npm token is used
    • Node needs to be updated to 24.5 or higher (npm CLI version 11.5.1 or higher)
  • nx release runs all steps as when we run it manually, i.e.:
    • skip if there's nothing to release
    • generate next version tag from commit history
    • update changelog
    • push tagged release commit
    • build all publishable packages
    • publish packages to npm
    • create GitHub release with description from changelog

Activity

  1. self-assigned this
    on Sep 12, 2025
  2. added theissue type on Sep 12, 2025
  3. BioPhoton commented on Sep 12, 2025

    @BioPhoton
    Collaborator

    🔥🔥🔥🔥

  4. matejchalk commented on Sep 24, 2025

    @matejchalk
    CollaboratorAuthor

    Re-opening as it turns out the github action bot can't push to main (see CI error):

    NX Pushing to git remote "origin"

    NX Unexpected git push error: remote: error: GH006: Protected branch update failed for refs/heads/main.

    remote:
    remote: - Changes must be made through a pull request.
    To https://github.com/code-pushup/cli
    ! [remote rejected] main -> main (protected branch hook declined)
    ! [remote rejected] v0.80.0 -> v0.80.0 (atomic transaction failed)
    error: failed to push some refs to 'https://github.com/code-pushup/cli'

    I temporarily disabled branch protection to make the 0.80.0 release go through on re-run. But it looks like we'll need to authenticate with a GitHub App instead.

  5. matejchalk commented on Sep 26, 2025

    @matejchalk
    CollaboratorAuthor

    Finally got it working 🎉

    The fixes are documented in the following PRs:

    The publish.yml failed initially because of release environment restrictions to main branch. I fixed this by adding v*.*.* tag patterns, and then adding a ruleset which restricts who can push these version tags.

    I did a final test with our 0.80.2 release, both Release and Publish worked as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions