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

Publish GitHub Release from release.bash script #55

Closed
remkop opened this issue Jul 25, 2020 · 2 comments
Closed

Publish GitHub Release from release.bash script #55

remkop opened this issue Jul 25, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@remkop
Copy link
Collaborator

remkop commented Jul 25, 2020

See if it is feasible/what is involved to publish a GitHub Release from the release.bash script.

That would make the release.bash script a true "one push" button that does the full release all the way up to publishing the distribution zip with ami binaries to GitHub Packages.

This likely involves making a curl call to the GitHub REST API.

Release Notes are an open issue here.

Now that we have more formal releases, I think it makes sense for each release to have release notes. This could be as simple as a summary and a list of issues fixed.

In the picocli project I track all changes in GitHub issues and group them in "Milestones" that correspond to releases. I have a separate RELEASE_NOTES.md file in the project where I write a post for each release. This is quite a lot of work, we can be less formal, but some release notes would be nice and we should think about where to store them.

@remkop
Copy link
Collaborator Author

remkop commented Jul 26, 2020

Looks like there is a GitHub Action workflow that automatically creates a GitHub Release when a tag is pushed whose tag name starts with 'v': https://github.com/actions/create-release

This may be simplest: no need to modify the release.bash script.
Regarding Release Notes: there is a body_path parameter that can be pointed to a RELEASE_NOTES.md file.


Alternatively, we can use the GitHub REST API: https://developer.github.com/v3/repos/releases/#input

The JSON to send looks fairly straightforward:

{
  "tag_name": "v1.0.0",
  "target_commitish": "master",
  "name": "v1.0.0",
  "body": "Description of the release",
  "draft": false,
  "prerelease": false
}

The authentication may be an issue when calling the REST API; we would need to specify a token.
We may be able to get this from the git config (see this example).

Example curl command:

curl -v -s \
  -H "Authorization: token xxxxxxxxx" \
  -H "Content-Type:application/json" \
  "https://api.github.com/repos/:owner/:repo/releases" \
  -d '{ "user" : { "email" : "XXXXXXX", "password" : "XXXXX"}, "tag_name": "1.2.1", "target_commitish": "master", "name": "1234", "body": "Release of version 1234", "draft": false, "prerelease": false}'

@remkop remkop added the enhancement New feature or request label Jul 26, 2020
remkop added a commit that referenced this issue Jul 26, 2020
remkop added a commit that referenced this issue Jul 26, 2020
remkop added a commit that referenced this issue Jul 26, 2020
remkop added a commit that referenced this issue Jul 26, 2020
remkop added a commit that referenced this issue Jul 27, 2020
remkop added a commit that referenced this issue Jul 27, 2020
@remkop remkop closed this as completed in 37106d1 Jul 27, 2020
remkop added a commit that referenced this issue Jul 27, 2020
@remkop
Copy link
Collaborator Author

remkop commented Jul 27, 2020

Example output:

remko@LAPTOP-7EO0MTL0:/mnt/c/Users/remko/IdeaProjects/ami3a/ami3$ time ./release.bash
Releasing v2020.07.27_02.23.15
Checking for uncommitted changes...
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< org.contentmine:ami3 >------------------------
[INFO] Building ami3 2020.07.27_01.47-NEXT-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-scm-plugin:1.11.2:check-local-modification (default-cli) @ ami3 ---
[INFO] Executing: /bin/sh -c cd '/mnt/c/Users/remko/IdeaProjects/ami3a/ami3' && 'git' 'rev-parse' '--show-prefix'
[INFO] Working directory: /mnt/c/Users/remko/IdeaProjects/ami3a/ami3
[INFO] Executing: /bin/sh -c cd '/mnt/c/Users/remko/IdeaProjects/ami3a/ami3' && 'git' 'status' '--porcelain' '.'
[INFO] Working directory: /mnt/c/Users/remko/IdeaProjects/ami3a/ami3
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  42.919 s
[INFO] Finished at: 2020-07-27T11:24:00+09:00
[INFO] ------------------------------------------------------------------------
... OK. The workspace is clean.
Checking Release Notes for this release (RELEASE-NOTES-NEXT.md)...
... OK. Release Notes exist.
Prepending RELEASE-NOTES-NEXT.md to RELEASE-NOTES.md...
... Updated RELEASE-NOTES.md OK.
Updating release version in pom.xml to 2020.07.27_02.23.15...
Committing pom.xml and RELEASE-NOTES.md...
warning: LF will be replaced by CRLF in RELEASE-NOTES.md.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in RELEASE-NOTES.md.
The file will have its original line endings in your working directory.
... Committed OK.
Tagging last commit...
... Tagged last commit OK.

Preparing for next development cycle...
Resetting RELEASE-NOTES-NEXT.md to template...
Updating version in pom.xml to v2020.07.27_02.23-NEXT-SNAPSHOT...
Committing pom.xml and RELEASE-NOTES-NEXT.md...
warning: LF will be replaced by CRLF in RELEASE-NOTES-NEXT.md.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in RELEASE-NOTES-NEXT.md.
The file will have its original line endings in your working directory.
... Committed SNAPSHOT version and reset Release Notes OK.
Pushing changes...
... Pushed changes OK.

Release 2020.07.27_02.23.15 completed successfully.
See https://github.com/petermr/ami3/actions to monitor the GitHub Actions triggered by this tag.

real    1m10.773s
user    0m15.344s
sys     1m0.453s

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

No branches or pull requests

1 participant