Skip to content

Commit 7e38e54

Browse files
authored
chore: Add release plz (#66)
* Add release plz Signed-off-by: Todd Baert <[email protected]> * Update release doc Signed-off-by: Todd Baert <[email protected]> * Add notes about adding release content Signed-off-by: Todd Baert <[email protected]> Signed-off-by: Todd Baert <[email protected]>
1 parent 89ea363 commit 7e38e54

9 files changed

+95
-69
lines changed

.github/workflows/lint-pr.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: 'Lint PR'
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
10+
jobs:
11+
main:
12+
name: Validate PR title
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: amannn/action-semantic-pull-request@v4
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/merge.yml

+4
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ jobs:
5656
name: coverage # optional
5757
fail_ci_if_error: true # optional (default = false)
5858
verbose: true # optional (default = false)
59+
60+
# Add -SNAPSHOT before deploy
61+
- name: Add SNAPSHOT
62+
run: mvn versions:set -DnewVersion='${project.version}-SNAPSHOT'
5963

6064
- name: Deploy
6165
run: |

.github/workflows/release.yml

+46-45
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,52 @@
1-
# This workflow uses actions that are not certified by GitHub.
2-
# They are provided by a third-party and are governed by
3-
# separate terms of service, privacy policy, and support
4-
# documentation.
5-
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
6-
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle
7-
8-
# maven deploy commands via via https://tech.clevertap.com/automate-releases-to-maven-central-via-github-actions/
9-
10-
name: Release
1+
# This workflow creates a running release please PR, which tracks all changes
2+
# based on semantic PR titles. When that PR is merged, a publish occurs after
3+
# release please increments the version.
114

125
on:
13-
release:
14-
types: [created]
15-
6+
push:
7+
branches:
8+
- main
9+
name: Run Release Please
1610
jobs:
17-
build:
18-
11+
release-please:
1912
runs-on: ubuntu-latest
20-
permissions:
21-
contents: read
22-
packages: write
2313

14+
# Release-please creates a PR that tracks all changes
2415
steps:
25-
- uses: actions/checkout@v3
26-
- name: Set up JDK 8
27-
uses: actions/setup-java@v3
28-
with:
29-
java-version: '8'
30-
distribution: 'temurin'
31-
cache: maven
32-
server-id: ossrh
33-
server-username: ${{ secrets.OSSRH_USERNAME }}
34-
server-password: ${{ secrets.OSSRH_PASSWORD }}
35-
36-
- name: Configure GPG Key
37-
run: |
38-
echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import
39-
env:
40-
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
41-
42-
- name: Remove SNAPSHOT
43-
run: mvn versions:set -DremoveSnapshot
44-
45-
- name: Deploy
46-
run: |
47-
mvn --batch-mode \
48-
--settings release/m2-settings.xml clean deploy
49-
env:
50-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
51-
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
16+
- uses: google-github-actions/release-please-action@v3
17+
id: release
18+
with:
19+
command: manifest
20+
token: ${{secrets.GITHUB_TOKEN}}
21+
default-branch: main
22+
23+
# These steps are only run if this was a merged release-please PR
24+
- name: checkout
25+
if: ${{ steps.release.outputs.releases_created }}
26+
uses: actions/checkout@v3
27+
- name: Set up JDK 8
28+
if: ${{ steps.release.outputs.releases_created }}
29+
uses: actions/setup-java@v3
30+
with:
31+
java-version: '8'
32+
distribution: 'temurin'
33+
cache: maven
34+
server-id: ossrh
35+
server-username: ${{ secrets.OSSRH_USERNAME }}
36+
server-password: ${{ secrets.OSSRH_PASSWORD }}
37+
38+
- name: Configure GPG Key
39+
if: ${{ steps.release.outputs.releases_created }}
40+
run: |
41+
echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import
42+
env:
43+
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
44+
45+
- name: Deploy
46+
if: ${{ steps.release.outputs.releases_created }}
47+
run: |
48+
mvn --batch-mode \
49+
--settings release/m2-settings.xml clean deploy
50+
env:
51+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
52+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}

.release-please-manifest.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ We hold regular meetings which you can see [here](https://github.com/open-featur
108108

109109
We are also present on the `#openfeature` channel in the [CNCF slack](https://slack.cncf.io/).
110110

111+
## Releasing
112+
113+
See [releasing](./docs/release.md).
114+
111115
## Contributors
112116

113117
Thanks so much to our contributors.

docs/release.md

+6-23
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,11 @@
1-
This is a simple checklist when performing a release.
1+
# Releases
22

3-
1. Ensure we're up-to-date with the current spec via `./spec_finder.py --diff-output --refresh-spec`
4-
2. Update `README.md` with the current spec that we're up to
5-
3. Update `README.md` to keep the install instructions on the right version
6-
4. Update `<version>` in pom.xml
7-
5. Run `mvn verify` to ensure it all works.
8-
6. Commit the results as the new version.
3+
This repo uses _Release Please_ to release packages. Release Please sets up a running PR that tracks all changes in the library, and maintains the versions according to [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/), generated when [PRs are merged](https://github.com/amannn/action-semantic-pull-request), based on the PR title. The semantics of the PR title are enforced by the `lint-pr.yml` workflow. When Release Please's running PR is merged, a new release is created, and the associated artifacts are published.
94

10-
Then in GitHub, trigger a release.
5+
## Customization of changelog and release notes.
116

12-
1. Go to [github releases](https://github.com/open-feature/java-sdk/releases/new)
13-
2. Name a tag w/ the version you want to release (e.g. `0.1.0`)
14-
3. Click the generate release notes button and write some text about what actually changed.
15-
4. Submit
16-
5. Validate the action which builds the result happened correctly.
7+
If you'd like to add custom content to a release, you can do this by editing the content in a Release Please PR's description. This content will be added to the notes for that release. If you'd like to add content to the changelog, simply push updates to the changelog in the Release Please PR.
178

18-
If something went wrong above, here's how you reset.
19-
1. Save the release notes you wrote.
20-
2. Delete the release.
21-
3. Delete the tag with `git push --delete origin 0.1.0` where 0.1.0 is your tag name.
9+
## Configuration
2210

23-
```shell
24-
gh release delete 0.1.0 -y
25-
git push --delete origin 0.1.0
26-
27-
gh release create 0.1.0 -F /tmp/010-release.md -t 0.1.0
28-
```
11+
The `release-please-config.json` defines the release please configuration. See schema [here](https://github.com/googleapis/release-please/blob/main/schemas/config.json) to understand all the options. We use the "simple" release strategy and annotate the POM with an element to help release please find the correct XML entity to update (the version element). Release Please stores it's understanding of the current version in the `version.txt` file.

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>dev.openfeature</groupId>
66
<artifactId>javasdk</artifactId>
7-
<version>0.1.1-SNAPSHOT</version>
7+
<version>0.1.1</version> <!--x-release-please-version -->
88

99
<properties>
1010
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

release-please-config.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"bootstrap-sha": "c701a6c4ebbe1170a25ca7636a31508b9628831c",
3+
"packages": {
4+
".": {
5+
"package-name": "dev.openfeature.javasdk",
6+
"release-type": "simple",
7+
"bump-minor-pre-major": true,
8+
"bump-patch-for-minor-pre-major": true,
9+
"versioning": "default",
10+
"extra-files": [
11+
"pom.xml"
12+
]
13+
}
14+
}
15+
}

version.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.1.1

0 commit comments

Comments
 (0)