Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
23 changes: 12 additions & 11 deletions .github/workflows/publish-knowledge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:

permissions:
contents: write # attach release asset
packages: write # push to GitHub Packages

jobs:
publish-knowledge:
Expand Down Expand Up @@ -58,7 +57,8 @@ jobs:
- name: Extract version from tag
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/}
RAW=${GITHUB_REF#refs/tags/}
VERSION=${RAW#v}
echo "version=$VERSION" >> $GITHUB_OUTPUT

- name: Build knowledge artifact
Expand All @@ -73,31 +73,32 @@ jobs:
java-version: '17'
distribution: 'temurin'

- name: Configure Maven settings for GitHub Packages
- name: Configure Maven settings for Clojars
run: |
mkdir -p ~/.m2
cat > ~/.m2/settings.xml <<'EOF'
<settings>
<servers>
<server>
<id>github</id>
<username>${env.GITHUB_ACTOR}</username>
<password>${env.GITHUB_TOKEN}</password>
<id>clojars</id>
<username>${env.CLOJARS_USERNAME}</username>
<password>${env.CLOJARS_PASSWORD}</password>
</server>
</servers>
</settings>
EOF

- name: Deploy knowledge artifact to GitHub Packages
- name: Deploy knowledge artifact to Clojars
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CLOJARS_USERNAME: ${{ secrets.CLOJARS_USERNAME }}
CLOJARS_PASSWORD: ${{ secrets.CLOJARS_PASSWORD }}
run: |
VERSION=${{ steps.version.outputs.version }}
# Skip deploy if artifact already exists (idempotent re-runs)
if curl -sf -H "Authorization: token ${GITHUB_TOKEN}" \
"https://maven.pkg.github.com/manetu/policyengine/com/manetu/mpe-knowledge/${VERSION}/mpe-knowledge-${VERSION}.jar" \
if curl -sfI \
"https://repo.clojars.org/io/github/manetu/mpe-knowledge/${VERSION}/mpe-knowledge-${VERSION}.jar" \
-o /dev/null; then
echo "Artifact ${VERSION} already exists in GitHub Packages, skipping deploy"
echo "Artifact ${VERSION} already exists on Clojars, skipping deploy"
else
VERSION=${VERSION} make knowledge-deploy
fi
Expand Down
10 changes: 5 additions & 5 deletions knowledge/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,20 @@ knowledge-build: $(VENV) ## Build the knowledge JAR
knowledge-install: knowledge-build ## Install JAR to ~/.m2 (for local iamlite dev)
mvn install:install-file \
-Dfile=$(TARGET) \
-DgroupId=com.manetu \
-DgroupId=io.github.manetu \
-DartifactId=mpe-knowledge \
-Dversion=$(VERSION) \
-Dpackaging=jar

knowledge-deploy: knowledge-build ## Deploy JAR to GitHub Packages (CI only)
knowledge-deploy: knowledge-build ## Deploy JAR to Clojars (CI only)
mvn deploy:deploy-file \
-Dfile=$(TARGET) \
-DgroupId=com.manetu \
-DgroupId=io.github.manetu \
-DartifactId=mpe-knowledge \
-Dversion=$(VERSION) \
-Dpackaging=jar \
-DrepositoryId=github \
-Durl=https://maven.pkg.github.com/manetu/policyengine
-DrepositoryId=clojars \
-Durl=https://repo.clojars.org/

knowledge-clean:
rm -rf knowledge/target
3 changes: 2 additions & 1 deletion knowledge/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,8 @@ def run_assemble() -> Path:
zf.write(CHUNKS_FILE, "chunks.jsonl")
zf.write(VECTORS_FILE, "vectors.bin")
zf.write(LEXICAL_FILE, "lexical-index.bin")
zf.write(pom_file, "META-INF/maven/com.manetu/mpe-knowledge/pom.xml")
pom_text = pom_file.read_text(encoding="utf-8").replace("${project.version}", version)
zf.writestr("META-INF/maven/io.github.manetu/mpe-knowledge/pom.xml", pom_text)

# Compute sha256 over sorted entry contents (deterministic, excludes timestamps)
h = hashlib.sha256()
Expand Down
31 changes: 18 additions & 13 deletions knowledge/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.manetu</groupId>
<groupId>io.github.manetu</groupId>
<artifactId>mpe-knowledge</artifactId>
<version>${project.version}</version>
<packaging>jar</packaging>
Expand All @@ -18,23 +18,28 @@
agent deployments without requiring a Python runtime at runtime.
</description>

<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Manetu Apache Maven Packages</name>
<url>https://maven.pkg.github.com/manetu/policyengine</url>
</repository>
</distributionManagement>
<url>https://github.com/manetu/policyengine</url>

<licenses>
<license>
<name>BUSL-1.1</name>
<url>https://github.com/manetu/policyengine/blob/main/LICENSE</url>
<distribution>repo</distribution>
</license>
</licenses>

<scm>
<url>https://github.com/manetu/policyengine</url>
<connection>scm:git:git://github.com/manetu/policyengine.git</connection>
<developerConnection>scm:git:ssh://git@github.com/manetu/policyengine.git</developerConnection>
</scm>

<build>
<plugins>
<!--
There is intentionally no compile / source plugin here.
The jar is assembled by knowledge/Makefile (a subsequent issue)
which invokes:
mvn package -Dproject.version=<semver>
and uses the maven-assembly-plugin (or jar:jar) to bundle the
pre-built knowledge/ output directory.
The jar is assembled by knowledge/build.py, which bundles the
pre-built knowledge/ output directory into a data-only zip.
-->
</plugins>
</build>
Expand Down
Loading