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

PHPC-2375: Manually merge up version bump commits #1586

Merged
merged 2 commits into from
Jun 17, 2024
Merged
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
36 changes: 30 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ jobs:
app_id: ${{ vars.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
submodules: true
fetch-depth: 0
Copy link
Member

Choose a reason for hiding this comment

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

Noted that this fetches the full history (secure-checkout/action.yml).


- name: "Set up drivers-github-tools"
uses: mongodb-labs/drivers-github-tools/setup@v2
Expand Down Expand Up @@ -109,20 +110,43 @@ jobs:
with:
version: ${{ inputs.version }}
tag_message_template: 'Release ${VERSION}'
# Don't push tag, we'll do that after merging up
push_tag: false

- name: "Bump to next development release and commit"
uses: mongodb-labs/drivers-github-tools/bump-version@v2
with:
version: ${{ inputs.version }}
version_bump_script: "./bin/update-release-version.php to-next-patch-dev"
commit_template: 'Back to -dev'
# Don't push commit, we still need to merge up
push_commit: false

- name: "Determine branch to merge up to"
id: get-next-branch
uses: alcaeus/automatic-merge-up-action/get-next-branch@main
Copy link
Member

Choose a reason for hiding this comment

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

Do you intend to merge this to mongodb-labs/drivers-github-tools at some point? If so, should there be a TODO?

Edit: I didn't realize alcaeus/automatic-merge-up-action existed already. Looks pretty involved (beyond the small actions in the DBX repo), so I understand if you want to leave this as-is. I think you should probably target a tag instead of @main, though.


Side note: WTF is dist/get-next-branch/index.js 20 KLOC? I assume you didn't write that yourself.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll keep the action separate for the time being. Once I've confirmed this works I'll tag the current state at v1 and update all of our repositories accordingly.

As for the 20 KLOC, all of the dependencies are compiled into a single file so that running the action from a workflow doesn't require installing them manually. The main dependencies are the actions toolkit that makes dealing with inputs, outputs, and the GitHub API easier.

with:
ref: ${{ github.ref_name }}
branchNamePattern: 'v<major>.<minor>'
fallbackBranch: 'master'

# TODO: Manually merge using ours strategy. This avoids merge-up pull requests being created
# Process is:
# 1. switch to next branch (according to merge-up action)
# 2. merge release branch using --strategy=ours
# 3. push next branch
# 4. switch back to release branch, then push
- name: "Manually merge up changes"
if: ${{ steps.get-next-branch.outputs.hasNextBranch }}
run: |
git checkout ${NEXT_BRANCH}
git merge --strategy=ours ${RELEASE_BRANCH}
git push origin ${NEXT_BRANCH}
git checkout ${RELEASE_BRANCH}
env:
NEXT_BRANCH: ${{ steps.get-next-branch.outputs.branchName }}
RELEASE_BRANCH: ${{ github.ref_name }}

- name: "Push tag and release branch"
run: |
git push origin ${RELEASE_BRANCH}
git push origin ${{ inputs.version }}
Copy link
Member

Choose a reason for hiding this comment

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

Alternatively, would git push origin tag ${{ inputs.version }} be less ambiguous? I picked that up while reading the git-push docs and https://stackoverflow.com/q/5195859

I also noted the advice in the SO thread to avoid using --tags, which we historically did (see: RELEASING.md). It appears that tag-version/action.yml is still doing that, so perhaps you'd like to revisit that at some point so it only explicitly pushes one tag.

Copy link
Member Author

Choose a reason for hiding this comment

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

TIL tag <name> is a thing. Updated to ensure what we're pushing is a tag ref.

env:
RELEASE_BRANCH: ${{ github.ref_name }}

- name: "Prepare release message"
run: |
Expand Down