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

feat: publish jvm artifacts #2640

Merged
merged 20 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 39 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ jobs:
docker tag ftl0/ftl-box:latest ftl0/ftl-box:"$GITHUB_SHA"
docker tag ftl0/ftl-box:latest ftl0/ftl-box:"$version"
docker push -a ftl0/ftl-box
create-release:
create-go-release:
name: Release Go Binaries
runs-on: ubuntu-latest
steps:
Expand All @@ -136,10 +136,47 @@ jobs:
env:
GITHUB_TOKEN: ${{ github.token }}
FTL_HOMEBREW_TOKEN: ${{ secrets.FTL_HOMEBREW_TOKEN }}
create-jvm-releases:
name: Release JVM Artifacts
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Init Hermit
uses: cashapp/activate-hermit@v1

- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-

- name: Set Version
working-directory: ./jvm-runtime/ftl-runtime
run: mvn versions:set -DnewVersion=${{ github.ref_name }}

- name: Build, Test, and Deploy to Maven Central
working-directory: ./jvm-runtime/ftl-runtime
run: |
# Maven deploy lifecycle will build, run tests, verify, sign, and deploy
mvn \
deploy \
-P ossrh,release \
--batch-mode \
--settings .maven_settings.xml
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SIGN_KEY_PASS: ${{ secrets.GPG_SECRET_PASSPHRASE }}
SIGN_KEY: ${{ secrets.GPG_SECRET_KEY }}

hermit-release:
name: Release Hermit
runs-on: ubuntu-latest
needs: [create-release]
needs: [create-go-release]
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
24 changes: 24 additions & 0 deletions jvm-runtime/ftl-runtime/.maven_settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<settings>
<servers>
<server>
<id>tbd-oss-releases</id>
<username>${env.ARTIFACTORY_USERNAME}</username>
<password>${env.ARTIFACTORY_PASSWORD}</password>
</server>
<server>
<id>tbd-oss-snapshots</id>
<username>${env.ARTIFACTORY_USERNAME}</username>
<password>${env.ARTIFACTORY_PASSWORD}</password>
</server>
<server>
<id>ossrh-snapshots</id>
<username>${env.SONATYPE_USERNAME}</username>
<password>${env.SONATYPE_PASSWORD}</password>
</server>
<server>
<id>ossrh-releases</id>
<username>${env.SONATYPE_USERNAME}</username>
<password>${env.SONATYPE_PASSWORD}</password>
</server>
</servers>
</settings>
203 changes: 203 additions & 0 deletions jvm-runtime/ftl-runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,37 @@
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Ftl Java Runtime - Parent</name>
<description>Towards a 𝝺-calculus for large-scale systems</description>
<url>https://tbd54566975.github.io/ftl/</url>

<scm>
<connection>scm:git:git://github.com/TBD54566975/ftl.git</connection>
<!-- This has to be HTTPS, not git://, for maven-release-plugin to do AUTH correctly -->
<developerConnection>scm:git:https://github.com/TBD54566975/ftl.git</developerConnection>
<url>https://github.com/TBD54566975/ftl</url>
<tag>HEAD</tag>
</scm>

<developers>
<developer>
<id>TBD54566975</id>
<name>Block, Inc.</name>
<email>[email protected]</email>
</developer>
</developers>

<issueManagement>
<system>github</system>
<url>https://github.com/TBD54566975/ftl/issues</url>
</issueManagement>

<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>

<modules>
<module>common</module>
Expand Down Expand Up @@ -207,8 +238,47 @@
<artifactId>quarkus-extension-maven-plugin</artifactId>
<version>${quarkus.version}</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<configuration>
<deployAtEnd>true</deployAtEnd>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.simplify4u.plugins</groupId>
<artifactId>sign-maven-plugin</artifactId>
<version>1.1.0</version>
<executions>
<execution>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<!-- handles the deployment of the project's artifacts to a remote repository -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
</plugin>
</plugins>
</build>


Expand Down Expand Up @@ -293,5 +363,138 @@
</plugins>
</build>
</profile>

<profile>
<!-- Profile for releasing artifacts to Maven Central -->
<id>release</id>
<build>
<plugins>
<!-- produce signed artifacts -->
<plugin>
<groupId>org.simplify4u.plugins</groupId>
<artifactId>sign-maven-plugin</artifactId>
</plugin>
<!-- generates a JAR file containing the source code of the project -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jetbrains.dokka</groupId>
<artifactId>dokka-maven-plugin</artifactId>
<version>1.9.20</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>javadocJar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- used to deploy artifacts to Maven Central via OSSRH (OSS Repository Hosting).
It configures the nexus-staging-maven-plugin for automated deployment and release,
and sets up the distribution management for both snapshot and release repositories.
Activate this profile when deploying open-source projects to Maven Central. -->
<profile>
<!-- https://central.sonatype.org/publish/publish-maven/#deployment -->
<id>ossrh</id>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh-releases</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>
<!-- specifies where the project artifacts should be distributed or deployed. -->
<!-- tells Maven where to deploy your project's artifacts when you run mvn deploy -->
<distributionManagement>
<snapshotRepository>
<id>ossrh-snapshots</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<!-- Sonatype's OSSRH - replicates to Maven Central within 30min of publish -->
<repository>
<id>ossrh-releases</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
</profile>
</profiles>

<!-- specifies where the project artifacts should be distributed or deployed.
tells Maven where to deploy your project's artifacts when you run mvn deploy -->
<distributionManagement>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be in the .settings.xml? I also don't understand what the use case is here, won't the TBD artifactory pull them down from central once they have been released?

<!-- primary release repository. not being used yet -->
<repository>
<uniqueVersion>false</uniqueVersion>
<id>tbd-oss-releases</id>
<name>TBD OSS Releases Repository</name>
<url>https://blockxyz.jfrog.io/artifactory/tbd-oss-releases-maven2</url>
<layout>default</layout>
</repository>
<!-- primary snapshot repository for all "*-SNAPSHOT" artifacts. not yet being used -->
<snapshotRepository>
<uniqueVersion>false</uniqueVersion>
<id>tbd-oss-snapshots</id>
<name>TBD OSS Snapshots Repository</name>
<url>https://blockxyz.jfrog.io/artifactory/tbd-oss-snapshots-maven2</url>
<layout>default</layout>
</snapshotRepository>
</distributionManagement>

<!-- additional repositories that we can pull dependencies from -->
<repositories>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general this is a bad idea to put TBH repos into a publicly published pom. This will mean that projects consuming this pom will end up with these repositories in their repo list. If we really need them they should be in a
settings.xml file.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stuartwdouglas it may be best to connect with @ALRubinger as he paved the way here for other jvm artifacts at tbd. Take a look at web5-kt or tbdex-kt for reference.

No real opinions from my pov especially with limited jvm experience. Happy to do whatever you think makes sense.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have moved it to a settings.xml profile for now.

<!-- mirror for all third-party dependencies. acts as a redundancy that we can failover to if third-party deps become
unavailable -->
<repository>
<id>tbd-oss-thirdparty</id>
<name>tbd-oss-thirdparty</name>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>https://blockxyz.jfrog.io/artifactory/tbd-oss-thirdparty-maven2/</url>
</repository>
<!-- snapshot repository. -->
<repository>
<id>tbd-oss-snapshots</id>
<name>tbd-oss-snapshots</name>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<url>https://blockxyz.jfrog.io/artifactory/tbd-oss-snapshots-maven2/</url>
</repository>
</repositories>

<!-- additional repositories that we can pull plugins from -->
<pluginRepositories>
<pluginRepository>
<id>tbd-oss-thirdparty</id>
<name>tbd-oss-thirdparty</name>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>https://blockxyz.jfrog.io/artifactory/tbd-oss-thirdparty-maven2/</url>
</pluginRepository>
</pluginRepositories>
</project>