Skip to content
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

Added publishing automation #31

Merged
merged 15 commits into from
Oct 28, 2024
67 changes: 67 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Publish Package to Maven Central Repository

env:
API_HOST: ${{ vars.API_HOST }}
API_KEY: ${{ secrets.API_KEY }}
MAVEN_GPG_KEY: ${{ secrets.MAVEN_GPG_KEY }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
MAVEN_USERNAME: ${{ secrets.NEXUS_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.NEXUS_PASSWORD }}

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'

jobs:
build-and-publish:
name: >-
Build and Publish
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up JDK 1.11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_CENTRAL_TOKEN

- name: Set up Maven
uses: stCarolas/setup-maven@v5
with:
maven-version: 3.8.1

- name: Build
run: mvn -B package --file pom.xml

- name: Prepare Maven environnement for deployment to Sonatype
run: export MAVEN_OPTS="--add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED"

- name: Publish
run: mvn clean deploy

github-release:
name: >-
Upload to Github Release
needs:
- build-and-publish
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--notes ""
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ build
.classpath
.settings

.idea
101 changes: 82 additions & 19 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,39 +1,70 @@
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>openapi-java-client</artifactId>
<packaging>jar</packaging>
<name>openapi-java-client</name>
<version>2.2.0</version>
<url>https://github.com/openapitools/openapi-generator</url>
<description>OpenAPI Java</description>
<scm>
<connection>scm:git:[email protected]:openapitools/openapi-generator.git</connection>
<developerConnection>scm:git:[email protected]:openapitools/openapi-generator.git</developerConnection>
<url>https://github.com/openapitools/openapi-generator</url>
</scm>

<groupId>com.lilt.client</groupId>
<artifactId>lilt-java</artifactId>
<version>0.6.5</version>
<packaging>jar</packaging>
<licenses>
<license>
<name>Unlicense</name>
<url>http://unlicense.org</url>
<name>Lilt Client Library License</name>
<url>license.md</url>
<distribution>repo</distribution>
</license>
</licenses>

<name>${project.groupId}:${project.artifactId}</name>
<description>The Lilt REST API enables programmatic access to the full range of Lilt backend services including: * Training of and translating with interactive, adaptive machine translation * Large scale translation memory * The Lexicon, a large scale termbase * Programmatic control of the Lilt CAT environment. Translation memory synchronizationRequests and responses are in JSON format. The REST API only responds to HTTPS (SSL) requests. AuthenticationRequests are authenticated via REST API key, which requires the Business plan. Requests are authenticated using HTTP Basic Auth (https://en.wikipedia.org/wiki/Basic_access_authentication). Add your REST API key as both the username and password. For development, you may also pass the REST API key via the key query parameter. This is less secure than HTTP Basic Auth and is not recommended for production use. Quotas: Our services have a general quota of 4000 requests per minute. Should you hit the maximum requests per minute, you will need to wait 60 seconds before you can send another request.</description>
<url>https://github.com/lilt/lilt-java</url>
<inceptionYear>2015</inceptionYear>
<organization>
<name>Lilt</name>
<url>http://www.lilt.com</url>
</organization>
<developers>
<developer>
<name>OpenAPI-Generator Contributors</name>
<email>[email protected]</email>
<organization>OpenAPITools.org</organization>
<organizationUrl>http://openapitools.org</organizationUrl>
<name>Nicholas Chiu</name>
<email>[email protected]</email>
<organization>${project.organization.name}</organization>
<organizationUrl>${project.organization.organizationUrl}</organizationUrl>
</developer>
</developers>

<scm>
<connection>scm:git:[email protected]:openapitools/openapi-generator.git</connection>
<developerConnection>scm:git:[email protected]:openapitools/openapi-generator.git</developerConnection>
<url>https://github.com/openapitools/openapi-generator</url>
</scm>
<distributionManagement>
<repository>
<id>github</id>
<name>Lilt packages on GitHub</name>
<url>https://maven.pkg.github.com/lilt/lilt-java</url>
</repository>
</distributionManagement>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>2.4.0</version>
<configuration>
<licenseName>lilt_client_library_license</licenseName>
<licenseResolver>file://${project.basedir}/src/license</licenseResolver>
</configuration>
<executions>
<execution>
<id>first</id>
<goals>
<goal>update-file-header</goal>
</goals>
<phase>process-sources</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
Expand Down Expand Up @@ -182,6 +213,38 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.2.4</version>
<configuration>
<useAgent>false</useAgent>
</configuration>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<signer>bc</signer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.6.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
<tokenAuth>true</tokenAuth>
<autoPublish>true</autoPublish>
<waitUntil>published</waitUntil>
</configuration>
</plugin>
</plugins>
</build>

Expand Down Expand Up @@ -266,7 +329,7 @@
</dependency>
</dependencies>
<properties>
<java.version>1.7</java.version>
<java.version>11</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<gson-fire-version>1.8.5</gson-fire-version>
Expand Down
1 change: 1 addition & 0 deletions src/license/licenses.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lilt_client_library_license=Lilt Client Library License~~license:license.md~~header:header.txt
10 changes: 10 additions & 0 deletions src/license/lilt_client_library_license/header.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Lilt Client Library License – Source Supplied, Permissive, Attribution, Noncommercial

THE LILT CLIENT LIBRARY SOFTWARE OR WORK (AS DEFINED BELOW) IS PROVIDED UNDER
THE TERMS OF THIS ("LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER
APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE
OR COPYRIGHT LAW IS PROHIBITED. BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED
HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE
EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU
THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND
CONDITIONS.
Loading