Skip to content

Commit 8eb2510

Browse files
Tom WetjensShapeshifter
andauthored
Setup publishing to Maven central (#31)
* Add scm block to pom.xml * Set semver policy and tag format * Create build.yml Signed-off-by: Tom Wetjens <tomwetjens@gmail.com> * Disable depgraph for now * Add Maven plugins as instructed by Sonatype for publishing to Maven central. Fix Javadoc errors * Add gpg configuration * Fix gpg passphrase setting * Add server configuration * Add pinentry-mode and env var for gpg * Create release.yml Signed-off-by: Tom Wetjens <tomwetjens@gmail.com> * Do not require GPG key when building locally * Move Maven plugins needed for release to the 'release' profile * Add initial CONTRIBUTING.md * Trigger release workflow manually * [maven-release-plugin] prepare release shapeshifter-library-0.0.1 * [maven-release-plugin] prepare for next development iteration * Add repository to distributionManagement in pom.xml * Revert to 0.0.1-SNAPSHOT * Push tag and next development version after successful publish * Fix permissions of release workflow * Git config name before release plugin * [maven-release-plugin] prepare release shapeshifter-library-0.0.1 * Move maven-release-plugin outside profile because its configuration is needed before the release profile is activated * Revert to 0.0.1-SNAPSHOT * [maven-release-plugin] prepare release v0.0.1 * [maven-release-plugin] prepare for next development iteration * Apparently maven-release-plugin already pushes. Revert to 0.0.1-SNAPSHOT * Remove tag * Cleanup * [maven-release-plugin] prepare release v0.0.1 * [maven-release-plugin] prepare for next development iteration * Add ossrh env vars * [maven-release-plugin] prepare release v0.1.0 * [maven-release-plugin] prepare for next development iteration * Fix var * [maven-release-plugin] prepare release v0.1.0 * [maven-release-plugin] prepare for next development iteration * Fix CVE check. Deploy at end * Explicitly set release profile to be activated * Add required pom.xml elements * Add developers element to pom.xml * [maven-release-plugin] prepare release v0.2.0 * [maven-release-plugin] prepare for next development iteration * [maven-release-plugin] prepare release v0.3.0 * [maven-release-plugin] prepare for next development iteration --------- Signed-off-by: Tom Wetjens <tomwetjens@gmail.com> Co-authored-by: Shapeshifter <shapeshifter@lfenergy.org>
1 parent 14518b2 commit 8eb2510

12 files changed

Lines changed: 292 additions & 35 deletions

File tree

.github/workflows/build.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
3+
4+
name: build
5+
6+
on: [push]
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Set up JDK
16+
uses: actions/setup-java@v3
17+
with:
18+
java-version: '17'
19+
distribution: 'temurin'
20+
cache: maven
21+
22+
- name: Build with Maven
23+
run: mvn -B verify
24+
25+
# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
26+
#- name: Update dependency graph
27+
# uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6

.github/workflows/release.yml

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,31 @@ on:
77
workflow_dispatch:
88

99
jobs:
10-
build:
10+
release:
1111
runs-on: ubuntu-latest
1212
permissions:
1313
contents: write
14-
packages: write
15-
releases: write
1614

1715
steps:
18-
- uses: actions/checkout@v3
19-
- name: Set up JDK
20-
uses: actions/setup-java@v3
21-
with:
22-
java-version: '17'
23-
distribution: 'temurin'
16+
- uses: actions/checkout@v3
17+
18+
- name: Set up JDK
19+
uses: actions/setup-java@v3
20+
with:
21+
java-version: '17'
22+
distribution: 'temurin'
23+
server-id: ossrh
24+
server-username: OSSRH_USERNAME
25+
server-password: OSSRH_PASSWORD
26+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
27+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
28+
29+
- name: Publish to Maven central
30+
run: |
31+
git config user.name Shapeshifter
32+
git config user.email shapeshifter@lfenergy.org
33+
mvn -B release:prepare release:perform
34+
env:
35+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
36+
OSSRH_USERNAME: ${{ vars.OSSRH_USERNAME }}
37+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}

CONTRIBUTING.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Shapeshifter Library contributing guide
2+
3+
Thank you for investing your time in contributing to our project!
4+
5+
## Table of contents
6+
1. [Reporting bugs](#reporting-bugs)
7+
2. [Requesting features](#requesting-features)
8+
3. [Contributing code](#contributing-code)
9+
4. [Releasing new versions](#releasing-new-versions)
10+
5. [Code of conduct](#code-of-conduct)
11+
12+
## Reporting bugs
13+
14+
To be described.
15+
16+
## Requesting features
17+
18+
To be described.
19+
20+
## Contributing code
21+
22+
To be described.
23+
24+
## Releasing new versions
25+
26+
We use [semantic versioning](https://semver.org).
27+
28+
Given a version number MAJOR.MINOR.PATCH, increment the:
29+
- MAJOR version when you make incompatible API changes
30+
- MINOR version when you add functionality in a backward compatible manner
31+
- PATCH version when you make backward compatible bug/security fixes
32+
33+
### Major or minor release
34+
Whatever the version in the `pom.xml` is, that is the version that will be released.
35+
36+
For example if the version in the pom.xml is `1.0.0-SNAPSHOT`, then the released version will be `1.0.0`:
37+
1. Trigger the `release` workflow on the `main` branch.
38+
2. This will build and upload version `1.0.0` to the Maven repository and will set the next development version on the branch to `1.1.0-SNAPSHOT`.
39+
40+
By default, the minor version will be incremented. If you want to release or start work on a new major version, you will have to update the `pom.xml` to the new major version (appending `-SNAPSHOT`) before triggering the workflow.
41+
42+
### Security / bug fix release
43+
Let's assume the last release was `1.0.0` and you want to make a security or bug fix on it.
44+
45+
1. Create a new branch from the tag `v1.0.0`, e.g. `v1.0.x` (name can be anything).
46+
2. Update the version in the pom.xml to `1.0.1-SNAPSHOT`.
47+
3. Make your changes and commit them.
48+
4. Trigger the `release` workflow on the `v1.0.x` branch.
49+
5. This will build and upload version `1.0.1` to the Maven repository and will set the next development version on the branch to `1.0.2-SNAPSHOT`.
50+
6. Merge the branch `v1.0.x` into `main`.
51+
52+
You can keep the branch open to make more bug/security fixes and releases on the `v1.0.x` branch, or you can delete the branch when no longer needed.
53+
54+
This can be done for any previous release (including patch versions).
55+
56+
## Code of conduct
57+
58+
To be described.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Shapeshifter Library
22

3+
![build status](https://github.com/shapeshifter/shapeshifter-library/actions/workflows/build.yml/badge.svg)
4+
35
The Shapeshifter library is a library written in Java that implements
46
the [Shapeshifter](https://www.lfenergy.org/projects/shapeshifter/) UFTP (USEF Flex Trading
57
Protocol) protocol, and the UFTP protocol is part of a larger initiative called USEF, or Universal

api/pom.xml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
53
<modelVersion>4.0.0</modelVersion>
64

75
<parent>
86
<groupId>org.lfenergy.shapeshifter</groupId>
97
<artifactId>shapeshifter-library</artifactId>
10-
<version>0.0.1-SNAPSHOT</version>
8+
<version>0.4.0-SNAPSHOT</version>
119
<relativePath>../pom.xml</relativePath>
1210
</parent>
1311

1412
<artifactId>shapeshifter-api</artifactId>
1513

1614
<name>Shapeshifter API</name>
15+
<description>API module that contains the message classes and calculation functions.</description>
1716
<url>https://www.lfenergy.org/projects/shapeshifter/</url>
1817

1918
<properties>

api/src/main/java/org/lfenergy/shapeshifter/api/EntityAddress.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
* <li>The European Article Number (EAN), commonly used to uniquely identify connection points in the electricity network and therefore a natural identifier to do the same in USEF. An example of an EA using this scheme is: ean.871685900012636543</li>
1717
* <li>The USEF type 1 entity address (EA1) is designed to allow participants to generate unique identifiers for themselves and entities managed by them, without relying on a central authority.</li>
1818
* </ul>
19-
* </p>
2019
*/
2120
public record EntityAddress(Scheme scheme, String address) {
2221

core/pom.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
53
<modelVersion>4.0.0</modelVersion>
64

75
<parent>
86
<groupId>org.lfenergy.shapeshifter</groupId>
97
<artifactId>shapeshifter-library</artifactId>
10-
<version>0.0.1-SNAPSHOT</version>
8+
<version>0.4.0-SNAPSHOT</version>
119
<relativePath>../pom.xml</relativePath>
1210
</parent>
1311

core/src/main/java/org/lfenergy/shapeshifter/core/service/UftpParticipantService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* endpoint
1414
*
1515
* <pre>
16-
* @Service
16+
* &#064;Service
1717
* public class MyUftpParticipantService implements UftpParticipantService {
1818
* // ...
1919
* }

core/src/main/java/org/lfenergy/shapeshifter/core/service/validation/UftpUserDefinedValidator.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@
1111
*
1212
* <pre>
1313
*
14-
* public class MyCustomValidator implements UftpUserDefinedValidator<FlexRequest> {
14+
* public class MyCustomValidator implements UftpUserDefinedValidator&lt;FlexRequest&gt; {
1515
*
16-
* @Override
17-
* public boolean appliesTo(Class<? extends FlexRequest> clazz) {
16+
* &#064;Override
17+
* public boolean appliesTo(Class&lt;? extends FlexRequest&gt; clazz) {
1818
* // here you can filter on the message type that you want to validate on
1919
* return clazz.equals(FlexRequest.class);
2020
* }
2121
*
22-
* @Override
22+
* &#064;Override
2323
* public boolean valid(UftpParticipant sender, FlexRequest flexRequest) {
2424
* // implement your validation logic here; return true if valid, false otherwise
2525
* }
2626
*
27-
* @Override
27+
* &#064;Override
2828
* public String getReason() {
2929
* // this is the reason of the validation failure, this is returned to the sender if validation fails
3030
* return "My custom validation failed";

core/src/main/java/org/lfenergy/shapeshifter/core/service/validation/message/MinActivationFactorValidator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import org.lfenergy.shapeshifter.core.service.validation.ValidationOrder;
1313

1414
/**
15-
* Validates that the min activation factor (if present) is in the interval <0,1] (thus: > 0, <=1)
15+
* Validates that the min activation factor (if present) is in the interval &lt;0,1] (thus: &gt; 0, &lt;=1)
1616
*/
1717

1818

0 commit comments

Comments
 (0)