Skip to content

Commit 475f2a7

Browse files
authored
Merge pull request #3 from OctopusDeploy/michrich/maven-central
Publishing to Maven Central
2 parents 3630164 + ad99186 commit 475f2a7

3 files changed

Lines changed: 96 additions & 55 deletions

File tree

.github/workflows/maven-publish.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,17 @@ jobs:
1919
with:
2020
java-version: '11'
2121
distribution: 'temurin'
22-
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
2322
settings-path: ${{ github.workspace }} # location for the settings.xml file
23+
server-id: central
24+
server-username: MAVEN_CENTRAL_USERNAME # env variable for username in deploy
25+
server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy
26+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
27+
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
2428

25-
- name: Build with Maven
26-
run: mvn -B package --file pom.xml
27-
28-
- name: Publish to GitHub Packages Apache Maven
29-
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
29+
- name: Publish to Maven Central
30+
run: mvn clean deploy -s $GITHUB_WORKSPACE/settings.xml
3031
env:
3132
GITHUB_TOKEN: ${{ github.token }}
33+
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
34+
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
35+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

README.md

Lines changed: 7 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -16,61 +16,21 @@ This provider will work with Java 11 and above.
1616

1717
### Installation
1818

19-
The Octopus OpenFeature provider for Java is currently published to [GitHub Packages](https://github.com/OctopusDeploy/openfeature-provider-java/packages/2528379). It will be published to the Maven Central repository soon.
20-
21-
To add Maven package dependencies from GitHub Packages, you will need to add a Maven repository (in either your `settings.xml` or `pom.xml`), and create a GitHub Personal Access Token (classic) with `read:packages` scope, and configure this to be used to authenticate. An example `settings.xml` is shown below:
22-
23-
```xml
24-
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
25-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
26-
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
27-
http://maven.apache.org/xsd/settings-1.0.0.xsd">
28-
29-
<activeProfiles>
30-
<activeProfile>github</activeProfile>
31-
</activeProfiles>
32-
33-
<profiles>
34-
<profile>
35-
<id>github</id>
36-
<repositories>
37-
<repository>
38-
<id>central</id>
39-
<url>https://repo1.maven.org/maven2</url>
40-
</repository>
41-
<repository>
42-
<id>github</id>
43-
<url>https://maven.pkg.github.com/OctopusDeploy/openfeature-provider-java</url>
44-
<snapshots>
45-
<enabled>true</enabled>
46-
</snapshots>
47-
</repository>
48-
</repositories>
49-
</profile>
50-
</profiles>
51-
52-
<servers>
53-
<server>
54-
<id>github</id>
55-
<username>USERNAME</username>
56-
<password>TOKEN</password>
57-
</server>
58-
</servers>
59-
</settings>
60-
```
61-
Read the GitHub docs for more information on [working with GitHub Packages as a Maven registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry#authenticating-to-github-packages).
62-
63-
Once this is configured, you can add the Octopus OpenFeature provider as a dependency. The Maven example is shown below.
64-
19+
The Octopus OpenFeature provider for Java is available as a [Maven package](https://central.sonatype.com/artifact/com.octopus.openfeature/octopus-openfeature-provider). You can add it to your project using your dependency manager (e.g. Maven or Gradle).
6520

6621
```xml
6722
<dependency>
6823
<groupId>com.octopus.openfeature</groupId>
6924
<artifactId>octopus-openfeature-provider</artifactId>
70-
<version>0.1.0</version> <!-- use current version number -->
25+
<version>0.2.0</version> <!-- use current version number -->
7126
</dependency>
7227
```
7328

29+
```groovy
30+
implementation group: 'com.octopus.openfeature', name: 'octopus-openfeature-provider', version: '0.2.0'
31+
// Use current version number
32+
```
33+
7434
### Usage
7535

7636
```java

pom.xml

Lines changed: 79 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,103 @@
66

77
<groupId>com.octopus.openfeature</groupId>
88
<artifactId>octopus-openfeature-provider</artifactId>
9-
<version>0.2.0</version>
9+
<version>0.3.0-SNAPSHOT</version>
1010
<packaging>jar</packaging>
1111

1212
<name>Octopus Deploy OpenFeature Provider</name>
1313
<description>The Octopus Deploy provider for OpenFeature</description>
1414
<url>https://octopus.com/docs/feature-toggles</url>
1515

16+
<licenses>
17+
<license>
18+
<name>Apache License, Version 2.0</name>
19+
<url>https://www.apache.org/licenses/LICENSE-2.0.html</url>
20+
</license>
21+
</licenses>
22+
23+
<developers>
24+
<developer>
25+
<name>Michael Richardson</name>
26+
<email>michael.richardson@octopus.com</email>
27+
<organization>Octopus Deploy</organization>
28+
<organizationUrl>https://octopus.com</organizationUrl>
29+
</developer>
30+
</developers>
31+
1632
<properties>
1733
<maven.compiler.source>11</maven.compiler.source>
1834
<maven.compiler.target>11</maven.compiler.target>
1935
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2036
</properties>
21-
37+
38+
<scm>
39+
<url>https://github.com/OctopusDeploy/openfeature-provider-java</url>
40+
</scm>
41+
42+
<build>
43+
<plugins>
44+
<plugin>
45+
<groupId>org.sonatype.central</groupId>
46+
<artifactId>central-publishing-maven-plugin</artifactId>
47+
<version>0.8.0</version>
48+
<extensions>true</extensions>
49+
<configuration>
50+
<publishingServerId>central</publishingServerId>
51+
</configuration>
52+
</plugin>
53+
<plugin>
54+
<groupId>org.apache.maven.plugins</groupId>
55+
<artifactId>maven-source-plugin</artifactId>
56+
<version>3.3.1</version>
57+
<executions>
58+
<execution>
59+
<id>attach-sources</id>
60+
<phase>verify</phase>
61+
<goals>
62+
<goal>jar-no-fork</goal>
63+
</goals>
64+
</execution>
65+
</executions>
66+
</plugin>
67+
<plugin>
68+
<groupId>org.apache.maven.plugins</groupId>
69+
<artifactId>maven-javadoc-plugin</artifactId>
70+
<version>3.11.2</version>
71+
<executions>
72+
<execution>
73+
<id>attach-javadocs</id>
74+
<goals>
75+
<goal>jar</goal>
76+
</goals>
77+
</execution>
78+
</executions>
79+
</plugin>
80+
<plugin>
81+
<groupId>org.apache.maven.plugins</groupId>
82+
<artifactId>maven-gpg-plugin</artifactId>
83+
<version>3.2.7</version>
84+
<executions>
85+
<execution>
86+
<id>sign-artifacts</id>
87+
<phase>verify</phase>
88+
<goals>
89+
<goal>sign</goal>
90+
</goals>
91+
</execution>
92+
</executions>
93+
</plugin>
94+
</plugins>
95+
</build>
96+
97+
<!--
2298
<distributionManagement>
2399
<repository>
24100
<id>github</id>
25101
<name>GitHub Packages</name>
26102
<url>https://maven.pkg.github.com/OctopusDeploy/openfeature-provider-java</url>
27103
</repository>
28104
</distributionManagement>
105+
-->
29106

30107
<dependencies>
31108
<dependency>

0 commit comments

Comments
 (0)