Skip to content
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

chore(ci): add automatic merging of the release tag MONGOSH-2018 #2379

Merged
merged 6 commits into from
Feb 21, 2025

Conversation

gagik
Copy link
Contributor

@gagik gagik commented Feb 20, 2025

The new system requires us to manually merge into main. This automates it through a workflow.

It can also be triggered manually with a workflow dispatch.

The new system requires us to manually merge into main. This automates it through a workflow
@gagik gagik changed the title chore(ci): add automatic merging of the release tag chore(ci): add automatic merging of the release tag MONGOSH-2018 Feb 20, 2025
@gagik gagik marked this pull request as draft February 20, 2025 19:46
@gagik gagik marked this pull request as ready for review February 21, 2025 09:36
@gagik gagik force-pushed the gagik/workflow-for-merging branch from beb6548 to 539413b Compare February 21, 2025 09:39
@gagik gagik requested a review from nirinchev February 21, 2025 09:42
@gagik gagik force-pushed the gagik/workflow-for-merging branch from 694f3f1 to f3beb5d Compare February 21, 2025 09:47
@gagik gagik force-pushed the gagik/workflow-for-merging branch from f3beb5d to 21963c2 Compare February 21, 2025 09:47
on:
push:
tags:
- 'mongosh@[0-9]+.[0-9]+.*'
Copy link
Contributor

Choose a reason for hiding this comment

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

We can still enforce the 3 components:

Suggested change
- 'mongosh@[0-9]+.[0-9]+.*'
- 'mongosh@[0-9]+\.[0-9]+\.[0-9]+.*'

Though I'm not sure how strict we have to be here - I don't really expect we'll be pushing malformed mongosh@... tags

Copy link
Contributor Author

@gagik gagik Feb 21, 2025

Choose a reason for hiding this comment

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

not sure escaping is right, this isn't proper regex but confusingly GitHub thing: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet

Comment on lines 45 to 49
if git rev-parse "release/v${{ steps.version-match.outputs.group1 }}" >/dev/null 2>&1; then
echo "Error: Branch release/v$RELEASE_TAG already exists"
echo "If this version has already been released consider using a different one."
exit 1
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems redundant now, since we're not pushing that branch, there's no way for it to exist - is there?

fi

if git rev-parse "release/v${{ steps.version-match.outputs.group1 }}" >/dev/null 2>&1; then
echo "Error: Branch release/v$RELEASE_TAG already exists"
Copy link
Contributor

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?

@gagik gagik requested review from nirinchev and addaleax February 21, 2025 11:17

- name: Merge release tag into main
run: |
git merge ${{ github.ref }} -m "chore(release): merge changes from ${{ github.ref_name }}"
Copy link
Contributor Author

@gagik gagik Feb 21, 2025

Choose a reason for hiding this comment

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

also added a message seems otherwise it may either prompt us to do it or use the default which maybe isn't best? ideally it'd fast-forward but I think because of the changelog bumps etc this may not always be the case.

on:
push:
tags:
- 'mongosh@[0-9]+.[0-9]+.[0-9]+*'
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- 'mongosh@[0-9]+.[0-9]+.[0-9]+*'
- 'mongosh@[0-9]+.[0-9]+.[0-9]+'

I assume this is a regexp, in which case +* would be equivalent to just *

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, and, as Nikola suggested above, shouldn't it be

Suggested change
- 'mongosh@[0-9]+.[0-9]+.[0-9]+*'
- 'mongosh@[0-9]+\.[0-9]+\.[0-9]+'

then?

Copy link
Contributor Author

@gagik gagik Feb 21, 2025

Choose a reason for hiding this comment

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

It's GitHub regex-esque pattern: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
I think the idea is to allow -rc0.. though if it's just this we can also do

      - 'mongosh@[0-9]+.[0-9]+.[0-9]+'
      - 'mongosh@[0-9]+.[0-9]+.[0-9]-rc.[0-9]+'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure how escapes would work but GitHub Docs themselves don't use them and use i.e v[12].[0-9]+.[0-9]+

@gagik gagik force-pushed the gagik/workflow-for-merging branch from d21b0ba to d62c756 Compare February 21, 2025 11:53
@gagik
Copy link
Contributor Author

gagik commented Feb 21, 2025

Going to go ahead with merge to test it and can follow up if other changes are needed.

@gagik gagik merged commit 1190d9a into main Feb 21, 2025
14 of 15 checks passed
@gagik gagik deleted the gagik/workflow-for-merging branch February 21, 2025 12:10
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.

3 participants