goharbor / go-client

Client library with golang for accessing Harbor API.
Apache License 2.0
41 stars 19 forks source link

implement workflows for automatic releases #22

Closed luka5 closed 9 months ago

luka5 commented 11 months ago

As discussed in https://github.com/goharbor/go-client/pull/19, I did implement some workflows to automate the release process. This process now looks like:

  1. Trigger Workflow: Prepare new Release
    • Can be executed manually or included in some other workflow
    • Takes the new version as input argument
    • Updates the Readme + Makefile, runs make gen-harbor-api
    • Creates a PR
  2. Manually review PR + merge it
  3. Automatically triggered Workflow: Release new Version Tag
    • Runs on PR merge (or actually push to main)
    • Creates the Release + Tag

This requires the setting Allow GitHub Actions to create and approve pull requests in Settings > Actions > General to be enabled.

Tested in https://github.com/luka5/go-client/pulls

luka5 commented 11 months ago

To trigger this workflow automatically, we could consider adding gh workflow --repo goharbor/go-client run prepare-new-version.yml --field version=${{ github.event.inputs.version }} in the publish_release.yml workflow in goharbor/harbor. Just make sure, the token has enough permissions to trigger the workflow.

What do you think about this PR @chlins @wy65701436 @Vad1mo ?

Vad1mo commented 11 months ago

Thank you for your contribution, this looks good.

stonezdj commented 9 months ago

Hi, @luka5 After I merged your PR and triggered the action "Prepare new release" and input 2.10.0. but there is no release named 2.10.0 created. could you please describe the detail process to create a new release?

luka5 commented 9 months ago

Hi @stonezdj, the "Prepare new release" run (https://github.com/goharbor/go-client/actions/runs/7499663802/job/20416866914) did create https://github.com/goharbor/go-client/pull/23.

Now you can review it and approve. After merge, the new release will be created in https://github.com/goharbor/go-client/actions/workflows/tag-release.yml

luka5 commented 9 months ago

It looks like we should add the -s in https://github.com/goharbor/go-client/blob/main/.github/workflows/prepare-new-version.yml#L31

Vad1mo commented 9 months ago

@luka5 can we add that feature -s

luka5 commented 9 months ago

here we go: https://github.com/goharbor/go-client/pull/24