Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/merge-release-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Merge Release Tag

on:
push:
tags:
- 'mongosh@[0-9]+.[0-9]+.[0-9]+'
workflow_dispatch:

jobs:
merge-release-tag:
runs-on: ubuntu-latest

steps:
- uses: mongodb-js/devtools-shared/actions/setup-bot-token@main
id: app-token
with:
app-id: ${{ vars.DEVTOOLS_BOT_APP_ID }}
private-key: ${{ secrets.DEVTOOLS_BOT_PRIVATE_KEY }}

- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: "0"
token: ${{ steps.app-token.outputs.token }}

- name: Extract version from tag
id: version
run: echo "RELEASE_VERSION=$(echo ${GITHUB_REF} | sed -n 's/refs\/tags\/mongosh@\([0-9]\+\.[0-9]\+\.[0-9]\+\)/\1/p')" >> $GITHUB_ENV

- name: Validate release version
shell: bash
run: |
if [ -z "${RELEASE_VERSION}" ]; then
echo "RELEASE_TAG is not set or is empty"
exit 1
fi

if git rev-parse "release/v$RELEASE_VERSION" >/dev/null 2>&1; then
echo "Error: Branch release/v$RELEASE_TAG already exists"
Copy link
Collaborator

Choose a reason for hiding this comment

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

release/ is actually reserved as a prefix for releases we kick off from other release lines (e.g. if we wanted to do a 1.x.x release now, we'd do it from a release/v1.x.x branch) – maybe call this package-release/ or something similar?

echo "If this version has already been released consider using a different one."
exit 1
fi

- name: Create and push branch from tag
run: |
git checkout -b release/v$RELEASE_VERSION ${{ github.ref }}
git push origin release/v$RELEASE_VERSION

- name: Merge branch into main
run: |
git checkout main
git merge release/v$RELEASE_VERSION
git push origin main
git push -d origin release/v$RELEASE_VERSION
2 changes: 1 addition & 1 deletion packages/build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Execute the following steps to publish a new release:
```
Follow the instructions and verify the inferred release version is correct.
7. Wait for Evergreen to finish the publication stage.
8. The previous step will have pushed tags for the npm publishes. Check out the tag for `mongosh@<version>` (not `v<version>`), create a branch for it, push that branch and open a PR with it. Then immediately merge that branch **using the `git merge` CLI command into main** and push to main. **NEVER** use the Github PR merge functionality, since that would squash the commit and give it a new commit hash that is different from the one in the tag.
8. Ensure the release version bump has been automatically merged into the main branch from the `release/vx.x.x` branch.
9. Close the Jira ticket for the release, post an update in the `#mongosh` Slack channel and ping the docs team.

### Branches and Tags
Expand Down
Loading