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

feat: build and publish binaries on release by using make and action-gh-release #724

Merged
merged 1 commit into from
Mar 15, 2023

Conversation

kurokobo
Copy link
Contributor

@kurokobo kurokobo commented Jan 23, 2023

Closes #719

@TheRealHaoLiu
I saw that you were already assigned to the issue, so feel free to ignore this PR, but I've created this as a working demo 😃

Design

In this PR, I use make and action-gh-release to build and publish binaries.

  • make and action-gh-release

    • Pros:
      • Fully customizable
      • Any tags are allowed even if the tag does not satisfy semver
    • Cons:
      • Building rpms and debs can be a bit more complicated
  • GoReleaser

    • Pros:
      • Supports building rpms and debs in addition to building binaries
    • Cons:
      • Less customizable especially for rpms and debs
      • The tags for the release MUST satisfy semver (current v1.3.0.dev1 is not allowed)

The pros for GoReleaser is that it also supports building RPMs in addition to just binaries, but compiling SELinux policies and generating Bash Completion are required before GoReleaer, so it ends up being a bit more complicated.

Also, since non-semver tags are not allowed, the workflow will fail if we pass the tags like v1.3.0.dev1 when releasing manually.

So, first, I've created a PR to publish binaries using make in a straightforward and simple manner.

For demo purpose, GoReleaser version is here: #725

Test

Demo release is available on my forked repository: https://github.com/kurokobo/receptor/releases/tag/v1.3.1-demo1a

  1. Create release by hand
    image
  2. Wait for the the job publish in promote.yml to be completed.
  3. Ensure the release has been updated and binaries are published.
    image
  4. Download binaries and ensure works well.
    $ curl -LO https://github.com/kurokobo/receptor/releases/download/v1.3.1-demo1a/receptor_1.3.1-demo1a_linux_amd64.tar.gz
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
    100 20.8M  100 20.8M    0     0   9.8M      0  0:00:02  0:00:02 --:--:-- 18.4M
    
    $ tar zxvf receptor_1.3.1-demo1a_linux_amd64.tar.gz 
    receptor
    
    $ ./receptor --version
    v1.3.1-demo1a
    PS C:\Temp> Invoke-WebRequest https://github.com/kurokobo/receptor/releases/download/v1.3.1-demo1a/receptor_1.3.1-demo1a_windows_amd64.tar.gz -OutFile receptor_1.3.1-demo1a_windows_amd64.tar.gz
    
    PS C:\Temp> tar zxvf .\receptor_1.3.1-demo1a_windows_amd64.tar.gz
    x receptor.exe
    
    PS C:\Temp> .\receptor.exe --version
    v1.3.1-demo1a

@TheRealHaoLiu
Copy link
Member

@kurokobo ur the coolest ❤️

@kurokobo
Copy link
Contributor Author

kurokobo commented Feb 2, 2023

Thanks for moving forward this PR.
I've updated the code to remove top-level subdirectory inside the tar.gz, and also updated the above PR comment.

@tanganellilore
Copy link
Contributor

team, some news on it?

Makefile Show resolved Hide resolved
@AaronH88
Copy link
Contributor

AaronH88 commented Mar 6, 2023

This looks great!
You have got a really good explanation on how to use this release process in the PR, can this explanation be added to the receptor docs please? Perhaps https://github.com/ansible/receptor/blob/devel/docs/source/release_process.rst is a good place to update the docs

@kurokobo kurokobo requested review from AaronH88 and removed request for shanemcd and fosterseth March 7, 2023 13:08
@kurokobo
Copy link
Contributor Author

kurokobo commented Mar 7, 2023

@AaronH88
Thanks for your review! I've modified, rebased, and pushed to solve your comments.

As for the documentation, I just wrote an overview without mentioning specific tools, what do you think?
image

@kurokobo
Copy link
Contributor Author

kurokobo commented Mar 7, 2023

I forgot to mention that we need to change the permissions for GitHub Actions to Read and write permissions in the project settings (Settings > Actions > General) for this workflow to work.

image

@AaronH88
Copy link
Contributor

AaronH88 commented Mar 7, 2023

great work @kurokobo , running the github actions now 😄

@AaronH88
Copy link
Contributor

AaronH88 commented Mar 7, 2023

@shanemcd this PR linting is throwing a false positive.
I have reviewed the code and feel its ok to merge, however, I can not see the permissions for the workflows as outlined in the comments. Can you see these permissions?

@AaronH88
Copy link
Contributor

@kurokobo I have just checked with the internal team and the action permissions are set to "Read and Write",
Can you do a quick rebase please so we can get rid of this linting error?

@kurokobo
Copy link
Contributor Author

@AaronH88
Thanks for your confirmation, I've just rebased and force-pushed to my branch.

Copy link
Contributor

@AaronH88 AaronH88 left a comment

Choose a reason for hiding this comment

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

/lgtm

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.

[RFE] Publish pre-built binaries on the release page
4 participants