Skip to content

Commit

Permalink
Use GitHub release automation (#2502)
Browse files Browse the repository at this point in the history
Cucumber-JVM can now be released with Polyglot Release[1]. Polyglot Release
will prepare the project for release. Once prepared the changes are pushed
and the GitHub Action[2] will publish the release.

1: https://github.com/cucumber/polyglot-release
2: https://github.com/cucumber/action-publish-mvn

Co-authored-by: M.P. Korstanje <rien.korstanje@gmail.com>
Co-authored-by: Matt Wynne <matt@cucumber.io>
  • Loading branch information
3 people committed Aug 7, 2022
1 parent 3afe4b9 commit ce7b707
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 127 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/release-github.yml
@@ -0,0 +1,18 @@
name: Release GitHub

on:
push:
branches: [release/*]

jobs:
create-github-release:
name: Create GitHub Release and Git tag
runs-on: ubuntu-latest
environment: Release
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: cucumber/action-create-github-release@v1.1.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
24 changes: 24 additions & 0 deletions .github/workflows/release-java.yml
@@ -0,0 +1,24 @@
name: Release Maven

on:
push:
branches: [release/*]

jobs:
publish-mvn:
name: Publish Maven Package
runs-on: ubuntu-latest
environment: Release
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
cache: 'maven'
- uses: cucumber/action-publish-mvn@v2.0.0
with:
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
nexus-username: ${{ secrets.SONATYPE_USERNAME }}
nexus-password: ${{ secrets.SONATYPE_PASSWORD }}
11 changes: 6 additions & 5 deletions .github/workflows/build.yml → .github/workflows/test-java.yml
@@ -1,9 +1,10 @@
name: Cucumber CI
name: Test Java

on:
pull_request:
branches:
- '**'
workflow_call:
push:
branches:
- main
Expand Down Expand Up @@ -31,9 +32,9 @@ jobs:
with:
version: '11'
- name: Install dependencies
run: mvn install -DskipTests=true -DskipITs=true -Darchetype.test.skip=true -Dmaven.javadoc.skip=true -B --show-version
run: mvn install -Pinclude-extra-modules -DskipTests=true -DskipITs=true -Darchetype.test.skip=true -Dmaven.javadoc.skip=true -B --show-version
- name: Test
run: mvn verify
run: mvn verify -Pinclude-extra-modules
env:
CUCUMBER_PUBLISH_TOKEN: ${{ secrets.CUCUMBER_PUBLISH_TOKEN }}

Expand Down Expand Up @@ -75,9 +76,9 @@ jobs:
with:
version: '11'
- name: Install dependencies
run: mvn install -DskipTests=true -DskipITs=true -Darchetype.test.skip=true -Dmaven.javadoc.skip=true --batch-mode --show-version
run: mvn install -Pinclude-extra-modules -DskipTests=true -DskipITs=true -Darchetype.test.skip=true -Dmaven.javadoc.skip=true --batch-mode --show-version
- name: Test (Coverage)
run: mvn jacoco:prepare-agent verify jacoco:report
run: mvn jacoco:prepare-agent verify jacoco:report -Pinclude-extra-modules
- uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
Expand Down
50 changes: 0 additions & 50 deletions Makefile
Expand Up @@ -29,53 +29,3 @@ endif
cp -r target/compatibility-kit/devkit/samples/* compatibility/src/test/resources/features
rm -rf target/compatibility-kit
.PHONY: update-cck

update-dependency-versions:
mvn versions:force-releases
mvn versions:update-properties -DallowMajorUpdates=false -Dmaven.version.rules="file://`pwd`/.versions/rules.xml"
.PHONY: update-dependency-versions

update-major-dependency-versions:
mvn versions:force-releases
mvn versions:update-properties -DallowMajorUpdates=true -Dmaven.version.rules="file://`pwd`/.versions/rules.xml"
.PHONY: update-major-dependency-versions

update-changelog:
cat CHANGELOG.md | ./scripts/update-changelog.sh $(NEW_VERSION) > CHANGELOG.md.tmp
mv CHANGELOG.md.tmp CHANGELOG.md
.PHONY: update-changelog

.commit-and-push-changelog:
git commit -am "Update CHANGELOG for v$(NEW_VERSION)"
git push
.PHONY: .commit-and-push-changelog

.configure-cukebot-in-docker:
[ -f '/home/cukebot/configure' ] && /home/cukebot/configure
.PHONY: .configure-cukebot-in-docker

.release-in-docker: .configure-cukebot-in-docker default update-changelog .commit-and-push-changelog
mvn --batch-mode release:clean release:prepare -DautoVersionSubmodules=true -Darguments="-DskipTests=true -DskipITs=true -Darchetype.test.skip=true"
git checkout "v$(NEW_VERSION)"
mvn deploy -P-build-in-ci -Psign-source-javadoc -DskipTests=true -DskipITs=true -Darchetype.test.skip=true
git checkout $(CURRENT_BRANCH)
git fetch
.PHONY: .release-in-docker

release:
[ -d '../secrets' ] || git clone keybase://team/cucumberbdd/secrets ../secrets
git -C ../secrets pull
../secrets/update_permissions
docker run \
--volume "${shell pwd}":/app \
--volume "${shell pwd}/../secrets/configure":/home/cukebot/configure \
--volume "${shell pwd}/../secrets/codesigning.key":/home/cukebot/codesigning.key \
--volume "${shell pwd}/../secrets/gpg-with-passphrase":/home/cukebot/gpg-with-passphrase \
--volume "${shell pwd}/../secrets/.ssh":/home/cukebot/.ssh \
--volume "${HOME}/.m2/repository":/home/cukebot/.m2/repository \
--env-file "${shell pwd}/../secrets/secrets.list" \
--user 1000 \
--rm \
-it cucumber/cucumber-build:0.1.0@sha256:2ce049493dfadad62b78594e6728d1f85ccc5a2441b5a8b3f7a106a7bba39ec1 \
make .release-in-docker
.PHONY: release
69 changes: 2 additions & 67 deletions RELEASING.md
@@ -1,71 +1,6 @@
Releasing
=========
See [.github/RELEASING](https://github.com/cucumber/.github/blob/main/RELEASING.md).

The deployment process of `cucumber-jvm` is based on
[Deploying to OSSRH with Apache Maven](http://central.sonatype.org/pages/apache-maven.html#deploying-to-ossrh-with-apache-maven-introduction).

## Check [![Build Status](https://github.com/cucumber/cucumber-jvm/workflows/Cucumber%20CI/badge.svg)](https://github.com/cucumber/cucumber-jvm/actions) ##

Is the build passing?

```
git checkout main
```

Also check if you can upgrade any dependencies:

```
make update-dependency-versions
```

## Decide what the next version should be ##

Versions follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html). To sum it up, it depends on what's changed (see `CHANGELOG.md`). Given a version number MAJOR.MINOR.PATCH:

* Bump `MAJOR` when you make incompatible API changes:
* There are `Removed` entries, or `Changed` entries breaking compatibility
* A cucumber library dependency upgrade was major
* Bump `MINOR` when you add functionality in a backwards compatible manner:
* There are `Added` entries, `Changed` entries preserving compatibility, or
`Deprecated` entries
* Bump `PATCH` when you make backwards compatible bug fixes:
* There are `Fixed` entries

Display future version by running:

```
make version
```

Check if branch name and version are as expected. To change version run:

```
mvn versions:set -DnewVersion=X.Y.Z-SNAPSHOT
```

## Secrets ##

Secrets are required to make releases. Members of the core team can install
keybase and join the `cucumberbdd` team to access these secrets.

During the release process, secrets are fetched from keybase and used to sign
and upload the maven artifacts.

## Make the release ##

Check if branch name and version are as expected:

```
make version
```

Do the release:

```
make release
```

## Last bits ##
## When done ##

Update the cucumber-jvm version in the documentation project:

Expand Down
17 changes: 12 additions & 5 deletions pom.xml
Expand Up @@ -92,18 +92,25 @@
</build>
</profile>

<profile>
<!-- Modules are not included by default when building in CI.
Releases are also made from CI, and we do not want to release
these modules. -->
<id>include-extra-modules</id>
<modules>
<module>examples</module>
<module>compatibility</module>
</modules>
</profile>

<profile>
<id>build-in-ci</id>
<activation>
<property>
<name>CI</name>
<name>env.CI</name>
<value>true</value>
</property>
</activation>
<modules>
<module>examples</module>
<module>compatibility</module>
</modules>
<build>
<pluginManagement>
<plugins>
Expand Down

0 comments on commit ce7b707

Please sign in to comment.