Skip to content

Commit ad0f505

Browse files
committed
⚗️ Publish replicate-models as Maven module
1 parent 904a466 commit ad0f505

2 files changed

Lines changed: 65 additions & 0 deletions

File tree

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Generate Replicate Maven Modules
2+
3+
on:
4+
release:
5+
types: [ created ]
6+
7+
jobs:
8+
generate-modules:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
version: [
13+
{ name: "llama3", models: "meta/meta-llama-3-8b-instruct,meta/meta-llama-3-70b-instruct" },
14+
{ name: "flux", models: "black-forest-labs/flux-schnell" }
15+
]
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v4
23+
with:
24+
python-version: '3.x'
25+
26+
- name: Set up Java
27+
uses: actions/setup-java@v4
28+
with:
29+
distribution: 'temurin'
30+
java-version: '17'
31+
32+
- name: Install Python dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install -r replicate-java/replicate-tools/requirements.txt
36+
37+
- name: Run replicate-tools to download JSON schemas
38+
env:
39+
REPLICATE_API_TOKEN: ${{ secrets.REPLICATE_API_TOKEN }}
40+
REPLICATE_MODELS: ${{ matrix.version.models }}
41+
run: |
42+
cd replicate-java/replicate-tools
43+
python download_replicate_schemas.py
44+
45+
- name: Run Maven to generate Java models
46+
run: |
47+
cd replicate-java/replicate-models
48+
mvn clean install
49+
50+
- name: Deploy Maven artifact to GitHub Packages
51+
env:
52+
VERSION: ${{ github.event.release.tag_name }}-${{ matrix.version.name }}
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
run: |
55+
cd replicate-java/replicate-models
56+
mvn versions:set -DnewVersion=$VERSION
57+
mvn deploy

replicate-models/pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@
1616
<jsonschema2pojo.version>1.2.2</jsonschema2pojo.version>
1717
</properties>
1818

19+
<distributionManagement>
20+
<repository>
21+
<id>github</id>
22+
<name>GitHub Packages</name>
23+
<url>https://maven.pkg.github.com/MrGraversen/replicate-java</url>
24+
</repository>
25+
</distributionManagement>
26+
1927
<dependencies>
2028
<dependency>
2129
<groupId>com.fasterxml.jackson.core</groupId>

0 commit comments

Comments
 (0)