Skip to content

Commit

Permalink
Automatically release to maven central
Browse files Browse the repository at this point in the history
Release automatically when code is merged into the release branch.

The maven release plugin is no longer used, instead tracking of the
build number is moved into git, where the minor version is tracked as a tag.

Updating the major version requires manual changed to the poms, which
needs to be addressed in the future, but fortuantely major version
updates are rare.

If a major version is changed the minor version must be reset. This can be done with

```bash
git tag -d build-number-<x>
git push --delete origin build-number-<x>
```

Where `x` is the current build number.

The current development version is always x.x.0-SNAPSHOT.
  • Loading branch information
Henry Coles authored and hcoles committed Dec 8, 2020
1 parent 7876f3c commit c90f3ed
Show file tree
Hide file tree
Showing 16 changed files with 211 additions and 108 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Release
on:
push:
branches:
- release
jobs:
release:
runs-on: ubuntu-latest
# sonatype nexus sometimes hangs
timeout-minutes: 20
steps:
# The build number is stored as a tag in git
# If it needs to be reset (eg after a major number version change)
# run
# git tag -d build-number-<x>
# git push --delete origin build-number-<x>
- name: Generate build number
id: buildnumber
uses: einaregilsson/build-number@v3
with:
token: ${{secrets.github_token}}
- name: Install gpg secret key
run: |
cat <(echo -e "${{ secrets.GPG_SECRET_KEY }}") | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG
- name: Checkout project
uses: actions/checkout@v2
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: Setup Java JDK
uses: actions/setup-java@v1.4.3
with:
java-version: 8
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Configure Git user
run: |
git config user.email "actions@github.com"
git config user.name "GitHub Actions"
- name: Publish JAR
run: mvn -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE}} -B -Prelease deploy scm:tag -Drevision=${{ steps.buildnumber.outputs.build_number }} -DskipTests=true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ target/
*.iml
.checkstyle
dependency-reduced-pom.xml
.flattened-pom.xml
*/bin
1 change: 0 additions & 1 deletion perform_release.sh

This file was deleted.

2 changes: 1 addition & 1 deletion pitest-aggregator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.pitest</groupId>
<artifactId>pitest-parent</artifactId>
<version>1.5.3-SNAPSHOT</version>
<version>1.6.${revision}</version>
</parent>
<artifactId>pitest-aggregator</artifactId>
<description>Aggregates the output of report XML documents into a new combined HTML report</description>
Expand Down
8 changes: 6 additions & 2 deletions pitest-ant/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>pitest-parent</artifactId>
<groupId>org.pitest</groupId>
<version>1.5.3-SNAPSHOT</version>
<version>1.6.${revision}</version>
</parent>
<artifactId>pitest-ant</artifactId>
<name>pitest-ant</name>
Expand Down Expand Up @@ -77,7 +77,11 @@
</configuration>
</execution>
</executions>

</plugin>
<!-- must run after shade -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
Expand Down
2 changes: 1 addition & 1 deletion pitest-build-config/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>pitest-parent</artifactId>
<groupId>org.pitest</groupId>
<version>1.5.3-SNAPSHOT</version>
<version>1.6.${revision}</version>
</parent>

</project>
8 changes: 6 additions & 2 deletions pitest-command-line/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>pitest-parent</artifactId>
<groupId>org.pitest</groupId>
<version>1.5.3-SNAPSHOT</version>
<version>1.6.${revision}</version>
</parent>
<artifactId>pitest-command-line</artifactId>
<name>pitest-command-line</name>
Expand Down Expand Up @@ -56,7 +56,11 @@
</executions>

</plugin>

<!-- must run after shade -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
</plugin>
</plugins>

</build>
Expand Down
7 changes: 6 additions & 1 deletion pitest-entry/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>pitest-parent</artifactId>
<groupId>org.pitest</groupId>
<version>1.5.3-SNAPSHOT</version>
<version>1.6.${revision}</version>
</parent>
<artifactId>pitest-entry</artifactId>
<name>pitest-entry</name>
Expand Down Expand Up @@ -35,6 +35,11 @@
</executions>

</plugin>
<!-- must run after shade -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand Down
7 changes: 4 additions & 3 deletions pitest-groovy-verification/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>pitest-parent</artifactId>
<groupId>org.pitest</groupId>
<version>1.5.3-SNAPSHOT</version>
<version>1.6.${revision}</version>
</parent>
<artifactId>pitest-groovy-verification</artifactId>
<packaging>jar</packaging>
Expand All @@ -18,9 +18,10 @@
<plugins>
<!-- Don't deploy to Maven Central -->
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
</configuration>
</plugin>

Expand Down
7 changes: 6 additions & 1 deletion pitest-html-report/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>pitest-parent</artifactId>
<groupId>org.pitest</groupId>
<version>1.5.3-SNAPSHOT</version>
<version>1.6.${revision}</version>
</parent>
<artifactId>pitest-html-report</artifactId>
<name>pitest-html-report</name>
Expand Down Expand Up @@ -65,6 +65,11 @@
</executions>

</plugin>
<!-- must run after shade -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
</plugin>

</plugins>

Expand Down
9 changes: 1 addition & 8 deletions pitest-java8-verification/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>pitest-parent</artifactId>
<groupId>org.pitest</groupId>
<version>1.5.3-SNAPSHOT</version>
<version>1.6.${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand All @@ -14,13 +14,6 @@

<build>
<plugins>
<!-- Don't deploy to Maven Central -->
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand Down
9 changes: 1 addition & 8 deletions pitest-maven-verification/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>pitest-parent</artifactId>
<groupId>org.pitest</groupId>
<version>1.5.3-SNAPSHOT</version>
<version>1.6.${revision}</version>
</parent>
<artifactId>pitest-maven-verification</artifactId>
<packaging>jar</packaging>
Expand All @@ -14,13 +14,6 @@

<build>
<plugins>
<!-- Don't deploy to Maven Central -->
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand Down
9 changes: 1 addition & 8 deletions pitest-maven/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>pitest-parent</artifactId>
<groupId>org.pitest</groupId>
<version>1.5.3-SNAPSHOT</version>
<version>1.6.${revision}</version>
</parent>
<artifactId>pitest-maven</artifactId>
<packaging>maven-plugin</packaging>
Expand Down Expand Up @@ -60,13 +60,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
31 changes: 4 additions & 27 deletions pitest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>pitest-parent</artifactId>
<groupId>org.pitest</groupId>
<version>1.5.3-SNAPSHOT</version>
<version>1.6.${revision}</version>
</parent>
<artifactId>pitest</artifactId>
<packaging>jar</packaging>
Expand Down Expand Up @@ -113,34 +113,11 @@
</configuration>
</execution>
</executions>

</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- must run after shade -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>javadoc</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<failOnError>false</failOnError>
</configuration>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
</plugin>

<plugin>
Expand Down
Loading

0 comments on commit c90f3ed

Please sign in to comment.