Skip to content

Use GitHub release automation #2502

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

Merged
merged 1 commit into from
Aug 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/pre-release-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Pre-release checks

on:
workflow_call:

jobs:

check-commit-ancestor:
name: Check commit ancestor
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Check commit has been pushed on origin/main
run: |
git fetch --quiet origin main
git merge-base --is-ancestor HEAD origin/main
25 changes: 25 additions & 0 deletions .github/workflows/release-github.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Release on github

on:
push:
branches:
- release/*

jobs:

pre-release-check:
uses: cucumber/cucumber-jvm/.github/workflows/prerelease-checks.yml@main

create-github-release:
name: Create GitHub Release and Git tag
needs: [pre-release-check]
runs-on: ubuntu-latest
environment: Release
permissions:
contents: write

steps:
- uses: actions/checkout@v3
- uses: cucumber/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
37 changes: 37 additions & 0 deletions .github/workflows/release-java.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release maven package

on:
push:
branches:
- release/*

jobs:

pre-release-check:
uses: cucumber/cucumber-jvm/.github/workflows/prerelease-checks.yml@main

test-java:
uses: cucumber/cucumber-jvm/.github/workflows/test-java.yml@main

publish-mvn:
name: Publish Maven Package
needs: [pre-release-check, test-java]
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/[email protected]
with:
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
nexus-username: cukebot
nexus-password: ${{ secrets.SONATYPE_PASSWORD }}
working-directory: java
11 changes: 6 additions & 5 deletions .github/workflows/build.yml → .github/workflows/test-java.yml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
15 changes: 11 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,17 @@
</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>
Expand All @@ -100,10 +111,6 @@
<value>true</value>
</property>
</activation>
<modules>
<module>examples</module>
<module>compatibility</module>
</modules>
<build>
<pluginManagement>
<plugins>
Expand Down