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

Automatic semantic versioning #593

Merged
merged 8 commits into from
Jun 3, 2024
Merged

Automatic semantic versioning #593

merged 8 commits into from
Jun 3, 2024

Conversation

pschork
Copy link
Collaborator

@pschork pschork commented Jun 1, 2024

Enables automatic semantic versioning to released docker images

To release tagged docker images

  1. Create and push a release branch
git checkout -b release/0.0.1
git push origin release/0.0.1
  1. Create a new eigenda release using a semver compliant tag ie v0.0.1 or v0.0.1-rc.1
  2. You're done. The workflow is automatically triggered and image published.

You can also create a tag locally and push to origin to automatically create a new release

git checkout -b release/0.0.1
git tag v0.0.1-rc.1 -m v0.0.1-rc.1
git push origin release/0.0.1
git push origin tag v0.0.1-rc.1

If you need/want to manually push an untagged release you can trigger the workflow manually and specify force flag. If you don't force, then the image is not published.
image

Previously the workflow required you to enter a bunch of redundant information. This is no longer necissary.
image

The Makefile is a bit ugly, but it is handling 2 error conditions

  1. someone downloaded a release zip archive and is trying to build from src. The archive does not include .git repo, so calculating semver is not possible. We fallback to using the parent dir name as the version (ie eigenda-0.7.1)
  2. If docker is not available, thus gitversion is not available, so we use fall back version 0.0.0

If a user clones eigenda where HEAD is tagged v0.8.0 and then commits some changes on master, then build docker image, their node --version will resolve semver to v0.8.1-pre.1. In that case gitversion knows that the last tagged release was v0.8.0, it assume a minor point release bump and append -pre.1 metadata aka prerelease.1.

@pschork pschork requested a review from dmanc June 1, 2024 05:26
@pschork pschork changed the title Pschork/semver Automatic semantic versioning Jun 1, 2024
@pschork pschork marked this pull request as ready for review June 3, 2024 17:31
Copy link
Contributor

@dmanc dmanc left a comment

Choose a reason for hiding this comment

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

lgtm, want to meet to understand how the gitversion.yml and then I'll approve

.github/workflows/docker-publish-release.yaml Outdated Show resolved Hide resolved
workflow_dispatch:
inputs:
force:
description: "Force untagged release (expert mode)"
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the usecase for pushing an untagged release?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Allows someone to release a feature branch for debugging. Running the workflow manually should be rare.

@pschork pschork merged commit 43b4e97 into master Jun 3, 2024
7 checks passed
pschork added a commit that referenced this pull request Jun 4, 2024
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