-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add bump workflow #49
Conversation
.github/workflows/bump.yml
Outdated
# Ensure that the provided version is greater than the current version | ||
validate: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | ||
|
||
- name: Get current version | ||
id: current-version | ||
run: | | ||
props_file=$(cat Directory.Build.props) | ||
version=$(echo "$props_file" | grep -oPm1 "(?<=<Version>)[^<]+") | ||
echo "version=$version" >> $GITHUB_OUTPUT | ||
|
||
- name: Validate new version | ||
run: | | ||
if npx semver "${{ inputs.version }}" --range "<= ${{ steps.current-version.outputs.version }}"; then | ||
echo "New version must be greater than the current version" | ||
exit 1 | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This uses the semver
tool to make sure that the new version is valid and greater than the current version
Hmm... I have mixed feelings about not bumping preemptively. I do like added safety harness that autobuilt stuff coming of a major 0.... and the theoritcal scenario of using a CI built package and loosking track of which SDK version you're using might simply be a 0.001%. I also like the tidyness of bumping preemptively, but either way I'm OK with the changes in this PR. If we later change or mind, we can just switch it up. |
Ultimately, your call. Both approaches have some trade offs. But I'm not attached to either. So keep the |
For now it's OK, we might reconsider if we experience pain points. |
@abergs okay it's ready then. Do I have your approval to merge? I will want to test it out after this to see if it works. I tested it locally, but unfortunately I can't test dispatch workflows off a branch on GitHub. We can just close the test PR, if that's okay. |
It works: #51 |
This adds a new, dispatchable workflow called
bump
. You can use it to update the current package version (of bothPasswordless
andPasswordless.AspNetCore
). It does that by updatingDirectory.Build.props
, committing changes to a new branch, and then creating a pull request. Very similar to what @abergs did in #27.In order to facilitate this workflow, I also took the liberty of performing one additional breaking change: auto-generated prerelease package versions for CI deployments now follow the pattern of
0.0.0-ci-BRANCH-RUNID
. The main difference is that the version is always0.0.0
.This change was done so that we could consolidate both
VersionPrefix
andVersionSuffix
into a singleVersion
property. It's not essential for this workflow to work, but then instead of one input it would likely take two (which is not a catastrophe).However, here are some advantages to this versioning schema:
Passwordless
version2.0.0
was already released, all subsequent CI builds would push a package with a version like2.0.0-ci-main-12345
. This meant that, in terms of semantic versioning, they appeared older than the stable2.0.0
package, which was actually released earlier.2.0.0
is released, we would update the current version to2.0.1
or something. The issue here is that we can't know ahead of time which component we should be bumping. The prerelease versions will be ordered correctly this way, but it feels weird to have a semantic version that's not actually semantic.2.0.0
and some workflow or user error resulted in another deployment of that package, it would fail because versions are immutable. However, if we preemptively bumped the version to2.0.1
, the erroneous deployment would go through.0.0.0-ci-BRANCH-RUNID
is a better naming schema. However, we might want to prepend the suffix with the current unix timestamp to make sure the prerelease versions are also ordered correctly between themselves.Again, if the version change is undesired, I can revert that part and change the
bump
workflow to take two inputs instead of one.