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

automate releases #347

Open
tobert opened this issue Jul 15, 2024 · 5 comments
Open

automate releases #347

tobert opened this issue Jul 15, 2024 · 5 comments

Comments

@tobert
Copy link
Collaborator

tobert commented Jul 15, 2024

Now that otel-cli has a good functional testing story, it's time to finally automate the last bits of the release process to get my computer out of the loop. I believe the remaining steps are something like this:

  • create a new token with permissions to write to packages and releases
  • set up a new GH Action that fires on new tags
    • build the release and run a go test -v which will run functional tests to validate the tag
      • current tests already do this
    • run goreleaser and it will do the rest
      • this must depend on a successful functional test

Once this is complete, a release can be made by tagging a sha and pushing tags, so package & release write access can be restricted to actions only.

@tobert
Copy link
Collaborator Author

tobert commented Jul 15, 2024

Also the release build should set the linker flags with the tag version and shas. See:

run: go build -v -ldflags="-s -w -X main.version=test -X main.commit=${{ github.sha }}"

@tobert
Copy link
Collaborator Author

tobert commented Jul 15, 2024

goreleaser should be setting the three linker flags automatically for release builds but for clarity there are three: main.version, main.commit, and main.date. These are printed by the otel-cli version subcommand and are invaluable for debugging.

The variables are defined in main.go: https://github.com/equinix-labs/otel-cli/blob/main/main.go

@displague
Copy link
Member

displague commented Jul 15, 2024

Instructions are in the Releases section of the README.md. A GitHub action could be used to trigger the tag and release.

In other Equinix and Equinix Labs projects, Conventional Commits and Semantic Release have been introduced to simplify this process and ensure that the correct semver revision is applied based on the commit messages. CI will fail of conventional commits are not used. Maintainers reviewing PRs must ensure the prefixes (feat!:, fix:, chore(build):, etc) match the content of the PR.

The Equinix Go SDK and Terraform providers follow this pattern.

@tobert
Copy link
Collaborator Author

tobert commented Jul 15, 2024

Releases follow semantic versioning since v0.0.1 and I've been writing a CHANGELOG.md for the last few releases. There have been no other maintainers to coordinate with so I feel the conventions are not as valuable as they are in a larger project context. For this project, releasing on tag push makes the most sense to me.

I now work on this in my personal time for free, and would prefer to not have the overhead. My feeling is that choices about how to maintain as a team should be made by that team when/if it materializes. For now, keeping the barrier to submitting & reviewing PRs low is paramount.

@auscompgeek
Copy link

An on-push GitHub Actions workflow should have write access to packages and releases, no need to mint a personal token. You may want to explicitly specify the permissions though. https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token

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

No branches or pull requests

3 participants