Skip to content

Commit

Permalink
Merge 2.13.0-SNAPSHOT back into master (#244)
Browse files Browse the repository at this point in the history
Support releasing versions using git push origin release/<version>

---------

Co-authored-by: oliverbye <oli@pobox.com>
Co-authored-by: GitHub Actions (run by olibye) <actions-bot@github.com>
  • Loading branch information
3 people committed Mar 10, 2024
1 parent 1c083a4 commit 4dd98cd
Show file tree
Hide file tree
Showing 16 changed files with 118 additions and 35 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Publish package to the Maven Central Repository
on:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Maven Central Repository
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Publish package
run: mvn --batch-mode deploy
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
56 changes: 56 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Maven deploy release
# Reset before repeated testing
# git push --delete origin 2.13.0
# git push -d origin release/2.13.0 release/2.13.0-snapshot
on:
push:
branches: [ "release/*" ]
jobs:
deploy:
# Avoid loops
if: github.event.commits[0].author.email != 'actions-bot@github.com'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Maven Central Repository
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
cache: maven
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase

- name: Split branch into release version
env:
BRANCH: ${{ github.ref_name }}
id: split
run: echo "fragment=${BRANCH##*/}" >> $GITHUB_OUTPUT

- name: Configure git user
run: |
git config user.email "actions-bot@github.com"
git config user.name "GitHub Actions (run by ${{ github.actor }})"
- name: Maven set release version
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
GH_TOKEN: ${{ github.token }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
run: |
mvn --no-transfer-progress versions:set -DoldVersion=\* -DnewVersion=${{ steps.split.outputs.fragment }} -DgroupId=org.jmock -DgenerateBackupPoms=false
git add .
git commit --no-edit -m "Release version ${{ steps.split.outputs.fragment }}"
git tag -a -m "Release version ${{ steps.split.outputs.fragment }}" ${{ steps.split.outputs.fragment }}
mvn --no-transfer-progress --batch-mode deploy -P release
mvn versions:set -DoldVersion=* -DnextSnapshot=true -DgroupId=org.jmock -DgenerateBackupPoms=false
git checkout -b ${{ github.ref_name }}-snapshot
git add .
git commit --no-edit -m "Open development for next release"
git push origin ${{ github.ref_name }} HEAD --tags
gh pr create -B master --title 'Merge ${{ github.ref_name }} back into master' --body 'Created by Github action'
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
name: Maven deploy to Maven Central
name: Maven deploy snapshot
on:
push:
# Pattern matched against refs/tags
tags:
- '*' # Push events to every tag not containing /
release:
types: [created]
branches: [ master ]
jobs:
publish:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion README.DEVELOPMENT
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ export SONATYPE_USERNAME=UUU
export SONATYPE_PASSWORD=PPPP
mvn clean deploy -P release --settings settings.xml -Dgpg.keyname=XXXXXXXX

mvn versions:set -DoldVersion=* -DnewVersion=2.11.0-SNAPSHOT -DgroupId=org.jmock -DgenerateBackupPoms=false
mvn versions:set -DoldVersion=* -DnewVersion=2.13.0-SNAPSHOT -DgroupId=org.jmock -DgenerateBackupPoms=false

2 changes: 1 addition & 1 deletion jmock-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<parent>
<groupId>org.jmock</groupId>
<artifactId>jmock-parent</artifactId>
<version>2.13.0-SNAPSHOT</version>
<version>2.13.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
4 changes: 2 additions & 2 deletions jmock-imposters-testdata/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<parent>
<groupId>org.jmock</groupId>
<artifactId>jmock-parent</artifactId>
<version>2.13.0-SNAPSHOT</version>
<version>2.13.0</version>
</parent>

<artifactId>jmock-imposters-testdata</artifactId>

<properties>
<scala.version>2.12.4</scala.version>
<scala.version>2.13.13</scala.version>
</properties>

<dependencies>
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion jmock-imposters-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.jmock</groupId>
<artifactId>jmock-parent</artifactId>
<version>2.13.0-SNAPSHOT</version>
<version>2.13.0</version>
</parent>
<artifactId>jmock-imposters-tests</artifactId>

Expand Down
2 changes: 1 addition & 1 deletion jmock-imposters/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.jmock</groupId>
<artifactId>jmock-parent</artifactId>
<version>2.13.0-SNAPSHOT</version>
<version>2.13.0</version>
</parent>
<artifactId>jmock-imposters</artifactId>
<description>Class mocks are more numerous than interface mocks, so drop the legacy name</description>
Expand Down
2 changes: 1 addition & 1 deletion jmock-junit3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.jmock</groupId>
<artifactId>jmock-parent</artifactId>
<version>2.13.0-SNAPSHOT</version>
<version>2.13.0</version>
</parent>

<artifactId>jmock-junit3</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jmock-junit4/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>org.jmock</groupId>
<artifactId>jmock-parent</artifactId>
<version>2.13.0-SNAPSHOT</version>
<version>2.13.0</version>
</parent>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion jmock-junit5/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>org.jmock</groupId>
<artifactId>jmock-parent</artifactId>
<version>2.13.0-SNAPSHOT</version>
<version>2.13.0</version>
</parent>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion jmock-legacy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>org.jmock</groupId>
<artifactId>jmock-parent</artifactId>
<version>2.13.0-SNAPSHOT</version>
<version>2.13.0</version>
</parent>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion jmock/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>org.jmock</groupId>
<artifactId>jmock-parent</artifactId>
<version>2.13.0-SNAPSHOT</version>
<version>2.13.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
43 changes: 26 additions & 17 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<groupId>org.jmock</groupId>
<artifactId>jmock-parent</artifactId>
<version>2.13.0-SNAPSHOT</version>
<version>2.13.0</version>
<packaging>pom</packaging>
<name>jMock 2 Parent</name>

Expand Down Expand Up @@ -338,6 +338,10 @@
<configuration>
<useAgent>true</useAgent>
<keyname>${gpg.keyname}</keyname>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
<executions>
<execution>
Expand All @@ -351,34 +355,39 @@
</plugin>

<plugin>
<!-- http://central.sonatype.org/pages/apache-maven.html -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>attach-sources</id>
<id>default-jar</id>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<!-- http://central.sonatype.org/pages/apache-maven.html -->
<!-- Annoying if the packager has to fix the java
doc -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<id>javadoc-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>javadoc</classifier>
</configuration>
</execution>
<execution>
<id>sources-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>sources</classifier>
</configuration>
</execution>
</executions>
</plugin>

</plugins>
</build>
</profile>
Expand Down
2 changes: 1 addition & 1 deletion testjar/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>org.jmock</groupId>
<artifactId>jmock-parent</artifactId>
<version>2.13.0-SNAPSHOT</version>
<version>2.13.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down

0 comments on commit 4dd98cd

Please sign in to comment.