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

PR or Tag based hex publishing #167

Open
tsloughter opened this issue Apr 24, 2023 · 11 comments
Open

PR or Tag based hex publishing #167

tsloughter opened this issue Apr 24, 2023 · 11 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@tsloughter
Copy link
Member

Opening this in hopes there is a kind soul interested in tackling this -- well, first assuming @bryannaegele supports this plan.

I'd like publishing to hex done through github actions. There are a couple ways to do this but I'm not sure the best. The issue is my initial idea is to base it on tags, so when a tag phoenix-1.1.1 is created then the version 1.1.1 is published of opentelemetry_phoenix. The problem is it'd be nice to have the application version be based on the tag if we aren't doing it off of a PR where it can be reviewed and this would be a pain for the Erlang apps.

Best would be if a PR could be opened to bump and release an application and it is done when that PR is merged. I don't know if that is even possible in Github Actions.

@tsloughter tsloughter added enhancement New feature or request help wanted Extra attention is needed labels Apr 24, 2023
@tsloughter
Copy link
Member Author

@tsloughter tsloughter changed the title Tag based hex publishing PR or Tag based hex publishing Apr 24, 2023
@bryannaegele
Copy link
Collaborator

I don't mind it but it gets super complicated and the flow would need to change source files and commit them to main.

We use https://github.com/marketplace/actions/release-drafter and releases at work but don't modify the app version. The mono-repo is going to make things complicated but it's theoretically possible.

For approach, releases probably make the most sense since we still need them to be manually released by the appropriate maintainer.

@tsloughter
Copy link
Member Author

I wouldn't want it having to change source files and committing them to main. If the version is based on the tag then it just means the mix.exs has to parse it from the tag when building.

@bryannaegele
Copy link
Collaborator

bryannaegele commented Apr 25, 2023 via email

@btkostner
Copy link

Another option is to use release-please to create a release PR. This will also modify source files to adjust the version, but it will be done via a PR so it's easily reviewable. Plus it has built in support for mono repos, changelogs, and documentation updates.

While not a mono repo, here is an example elixir PR: stordco/data-streams-ex#13

@tsloughter
Copy link
Member Author

No Erlang support :( but I guess it could be nice for Elixir packages in here

@btkostner
Copy link

There is a simple release type that just increments a version in the version file. Erlang could read that.

Otherwise, if this looks like a good solution, I can work upstream and add support.

@bryannaegele
Copy link
Collaborator

bryannaegele commented Jun 6, 2023

There is a simple release type that just increments a version in the version file. Erlang could read that.

Otherwise, if this looks like a good solution, I can work upstream and add support.

We don't want any actions/bots committing files, so I'm not sure that would work

#167 (comment)

@bryannaegele
Copy link
Collaborator

bryannaegele commented Jun 14, 2023

I'm working on this at work where we use release-drafter and finally found a legit monorepo setup.

https://github.com/guardrail-dev/guardrail/blob/master/.github/workflows/release-drafter.yml
https://github.com/guardrail-dev/guardrail/blob/master/.github/workflows/release.yml

Also found a way to secure who can trigger releases. It isn't pretty but would work. We're using github IDs rather than usernames though.

https://github.com/orgs/community/discussions/26008

@bryannaegele
Copy link
Collaborator

Alright. Got a job figured out at work to take a tag of project-semver and parse out the project and version. Those can then be used to figure out which job to run for a project and pass in the version as an arg. Since we can lock down who can create tags I don't really have a problem with having a manually triggered workflow only maintainers have access to that would write to a version file in the projects.

With the new rulesets we can get really granular.

Given a tag of opentelemetry-phoenix-v1.20.0-beta1 we'll get opentelemetry-phoenix as the project and v1.20.0-beta1 as the version.

    name: 'Extract project from tag'
    id: set-project-from-tag
    runs-on: ubuntu-20.04
    outputs:
      project: ${{ steps.set-project-from-tag.outputs.project }}
    steps:
      - run: |
          project="$(echo "$GITHUB_REF" | sed 's/\(^refs\/tags\/\)\([a-z-]*\)\(-v\)\(.*\)/\2/')"
          version="$(echo "$GITHUB_REF" | sed 's/\(^refs\/tags\/\)\([a-z-]*\)\(-v\)\(.*\)/v\4/')"
          echo "::group::Extract project and version"
          echo "extract project and version: ${GITHUB_REF}, ${project}, ${version}"
          echo "project=${project}" >> "$GITHUB_OUTPUT"
          echo "version=${version}" >> "$GITHUB_OUTPUT"
          echo "::endgroup::"

@tsloughter
Copy link
Member Author

Great!

Maybe needs to be a path to the project tho? Like instrumentation/opentelemetry_phoenix-v1.20.0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants