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

Automatically generates release note and binaries on release #126

Merged
merged 9 commits into from
Jan 5, 2023
Merged

Automatically generates release note and binaries on release #126

merged 9 commits into from
Jan 5, 2023

Conversation

torao
Copy link
Contributor

@torao torao commented Dec 9, 2022

Description

This PR is to create a release note and release binaries and list them in the repository release automatically when a release tag is pushed.

  • Note that now make build is only run targeting linux/amd64 to create the default binary. The binaries for other platforms will be built in subsequent PRs.
  • For now, the Docker image for the build is not created in a public repository like hub.docker.com, but instead docker build is performed within GitHub Actions (it may only take a few minutes).

Motivation and context

According to #116, it would be nice if Github Actions could be triggered at release time to generate binaries for various platforms, rather than having to try out LBM, as is done in cosmos/gaia.

How to use

There are two steps that must be taken at release:

  1. Rewrite the release note in ./RELEASE_NOTE.md. The contents of this file will be used to detail the release note.

    # LBM v0.0.0 Release Notes
    Write a description of release v0.0.0 here. Note the relative paths of the links.
  2. Create a release tag and push it.

    % git tag -a v0.1.2 -m '...'
    % git push origin v0.1.2
  3. This will then create a release note and release binaries, which will be listed in the repository release as Draft. Check the contents of the release and if there are no problems, publish it.

The available formal tag name formats are as follows:

v[0-9]+.[0-9]+.[0-9]+
v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+

It's also possible to build release binaries locally by executing the following make command:

% cd builders/build-artifacts
% docker build -t lbm/build-artifacts .
% cd ../..
% make distclean build-reproducible

This will create the release binaries in the ./artifacts directory.

Internal Architecture

When the release tag is pushed and release-build.yml is invoked, (1) build docker image first, (2) run make build-reproducible to, and (3) upload the generated build_report and release binaries.

build and release sequence

  • To add build targets: See the build-reproducible section of the Makefile. Also, if you have to do a special compilation for that target, add a conditional branch in .release-build.sh. In some cases, you may need to add apt get, etc. to builders/rbuilder/Dockerfile.
  • To change the format of the release note: You may modify the ./contrib/generate_release_note/main.go to create it.

How has this been tested?

I've confirmed that release notes and binaries are generated in my personal repository for working with GitHub Actions, and should be tested after it is merged into LBM's main branch.

Screenshots (if appropriate):

When this PR is merged, a tag like v0.0.0 will automatically create a release note like the following when pushed:

release notes listed in releases

Checklist:

  • I followed the contributing guidelines.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

The push of release tag should automatically generate release notes and release builds.
@torao torao self-assigned this Dec 9, 2022
@torao torao marked this pull request as ready for review December 9, 2022 11:39
@torao torao requested a review from zemyblue December 9, 2022 11:39
Copy link
Member

@zemyblue zemyblue left a comment

Choose a reason for hiding this comment

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

.github/workflows/release-build.yml Outdated Show resolved Hide resolved
asset_path: ./artifacts/lbm-${{ env.VERSION }}-linux-amd64
asset_name: lbm-${{ env.VERSION }}-linux-amd64
asset_content_type: application/binary
# - name: "Upload linux-arm64 artifact"
Copy link
Member

Choose a reason for hiding this comment

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

Do you know why it failed in this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So far I’ve confirmed that linux/arm64 produces the following assembler-level error, but I haven’t yet investigated the reason for it.

Building for linux/arm64
CGO_CFLAGS= CGO_LDFLAGS= CGO_ENABLED=1 go build -mod=readonly -tags "netgo ledger...
# runtime/cgo
gcc_arm64.S: Assembler messages:
gcc_arm64.S:28: Error: no such instruction: `stp x29,x30,[sp,'
gcc_arm64.S:32: Error: too many memory references for `mov'
gcc_arm64.S:34: Error: no such instruction: `stp x19,x20,[sp,'
gcc_arm64.S:37: Error: no such instruction: `stp x21,x22,[sp,'
...

@torao
Copy link
Contributor Author

torao commented Dec 13, 2022

@zemyblue

Please change the release note information to get from the RELEASE_NOTES.md like https://github.com/cosmos/cosmos-sdk/blob/v0.46.6/RELEASE_NOTES.md

Do you mean that it should generate the information to be displayed in the release from RELEASE_NOTE.md instead of CHANGELOG.md? If so, what's the specification and format of RELEASE_NOTE.md that you expected to use to extract the desired release information?

@zemyblue
Copy link
Member

@zemyblue

Please change the release note information to get from the RELEASE_NOTES.md like https://github.com/cosmos/cosmos-sdk/blob/v0.46.6/RELEASE_NOTES.md

Do you mean that it should generate the information to be displayed in the release from RELEASE_NOTE.md instead of CHANGELOG.md? If so, what's the specification and format of RELEASE_NOTE.md that you expected to use to extract the desired release information?

I hope it will look like https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.0. How can we do it?

@torao
Copy link
Contributor Author

torao commented Dec 14, 2022

@zemyblue

I hope it will look like https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.0. How can we do it?

Instead of parsing CHANGELOG.md and extracting the new release section as cosmossdk/gaia does, should I just use the contents itself of RELEASE_NOTE.md as the release details?

@zemyblue
Copy link
Member

@zemyblue

I hope it will look like https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.0. How can we do it?

Instead of parsing CHANGELOG.md and extracting the new release section as cosmossdk/gaia does, should I just use the contents itself of RELEASE_NOTE.md as the release details?

Yes. How do you think about this?

@torao
Copy link
Contributor Author

torao commented Dec 14, 2022

@zemyblue Understood. I think that's fine.

@torao torao changed the title Automatic creation of release note and binaries Automatically generates release note and binaries on release Dec 15, 2022
@torao
Copy link
Contributor Author

torao commented Dec 15, 2022

@zemyblue

  1. Tag format v0.0.0-rc0 is newly supported.
  2. Changed to create a release note with the contents of RELEASE_NOTE.md.
  3. The usage described in this PR has been modified to do so.

screenshot 2022-12-15 22 35 25

@torao torao requested a review from zemyblue December 15, 2022 13:39
RELEASE_NOTE.md Show resolved Hide resolved
Comment on lines 6 to 7
- "v[0-9]+"
- "v[0-9]+.[0-9]+"
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this case would exist according to our rules.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So only v0.0.0 and v0.0.0-rc0 formats?

Copy link
Member

Choose a reason for hiding this comment

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

OK

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

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.

3 participants