Skip to content

Release workflow #544

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Release workflow #544

wants to merge 7 commits into from

Conversation

paul-sachs
Copy link
Collaborator

@paul-sachs paul-sachs commented Jul 2, 2025

This is a modified version of a local script i've been using for a few releases. Hasn't been tested as an action yet but all we need is an NPM token configured as a secret and it should work.

New workflows for release management:

Prepare Release Workflow:

  • Added .github/workflows/prepare-release.yml to automate the creation of draft releases, release branches, and pull requests for new versions. Includes support for potential release/hotfix base branches in the case of a backport fix. To create a backport, we'll just need to create a branch for the target base version (release/v1.x) and set the base branch for the action.

Publish Release Workflow:

  • Added .github/workflows/publish-release.yml to handle the publication of merged release pull requests, including publishing to npm, updating GitHub release notes

Update Fixed Issues Workflow:

  • Added .github/workflows/updated-fixed-issues.yml to comment on fixed issues.

Signed-off-by: Paul Sachs <psachs@buf.build>
Signed-off-by: Paul Sachs <psachs@buf.build>
@paul-sachs paul-sachs requested a review from timostamm July 2, 2025 21:05
Signed-off-by: Paul Sachs <psachs@buf.build>
@paul-sachs
Copy link
Collaborator Author

After this is merged, I can run it through some dry runs of the first prepare stage which can be considered a noop if the branch is closed with accepting.

Signed-off-by: Paul Sachs <psachs@buf.build>
Signed-off-by: Paul Sachs <psachs@buf.build>
echo "✓ Version '${{ inputs.version }}' is valid semver"

- name: Install dependencies
run: npm install
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
run: npm install
run: npm ci

with:
node-version-file: ".nvmrc"
cache: "npm"
registry-url: "https://registry.npmjs.org"
Copy link
Member

Choose a reason for hiding this comment

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

Why are we setting registry-url here, but not elsewhere?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was also caught by this. It was not something I thought was necessary but then the example docs in setup-node actually make this explicit (see example here). It might not at all be necessary but since github actions are annoying to test, I went with their example.

Looking closer at the example, they might have only done it because they were also publishing to github packages as well, so probably not necessary at all.

registry-url: "https://registry.npmjs.org"

- name: Install dependencies
run: npm install
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
run: npm install
run: npm ci

Comment on lines 37 to 44
- name: Validate semver version
run: |
if ! echo "${{ inputs.version }}" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+(\.[a-zA-Z0-9]+)*)?(\+[a-zA-Z0-9]+(\.[a-zA-Z0-9]+)*)?$'; then
echo "Error: '${{ inputs.version }}' is not a valid semver version"
echo "Expected format: MAJOR.MINOR.PATCH (e.g., 1.2.3) or with pre-release/build metadata (e.g., 1.2.3-alpha.1+build.1)"
exit 1
fi
echo "✓ Version '${{ inputs.version }}' is valid semver"
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we can roll this check into the setversion script. It already uses a similar regex, and IMO it would be beneficial to have only a single piece of code checking the version number.

If the step for setversion moves up, this should work out, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually, looking at the set-workspace-version.js file, this is not necessary. We are already checking the incoming version and in fact don't allow things like "rc" releases so I'll just remove this entirely and defer to setversion

Copy link
Member

Choose a reason for hiding this comment

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

In protovalidate-es, set-workspace-version.js was crudely modified to accept RC versions. Would be nice to improve the regex a bit with what you have here, and also improve the error handling so that it returns a more helpful message.

env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Comment on fixed issues
Copy link
Member

Choose a reason for hiding this comment

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

Comments on fixed issues with a link to the release are great. But I think we'll have an easier time landing the release automation in all repositories if we decouple this step from the release workflow. For example, by putting into into a separate workflow we can adopt separately.

- Moved to npm ci
- Split issue updates into a distinct action
- Removed unnecessary registry option on publish setup

Signed-off-by: Paul Sachs <psachs@buf.build>
Signed-off-by: Paul Sachs <psachs@buf.build>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants