From 5a16bc690c9949544dd5e6a34a3a63aaaf0de276 Mon Sep 17 00:00:00 2001 From: Zakaria El Orche Date: Wed, 12 Aug 2026 19:38:18 +0000 Subject: [PATCH] ci: publish Maven packages to Gitea registry on push to master Lets Pathway (and other consumers) resolve dev.relism:flash from Gitea's Maven registry instead of requiring a local `mvn install`. Every push stamps all modules with a commit-scoped version (2.1.0-) before deploying, since Gitea's registry won't let a build overwrite an existing name+version. Co-Authored-By: Claude Sonnet 5 --- .gitea/maven-settings.xml | 24 +++++++++++++++++++ .gitea/workflows/publish-maven.yml | 37 ++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 .gitea/maven-settings.xml create mode 100644 .gitea/workflows/publish-maven.yml diff --git a/.gitea/maven-settings.xml b/.gitea/maven-settings.xml new file mode 100644 index 0000000..94a5bf5 --- /dev/null +++ b/.gitea/maven-settings.xml @@ -0,0 +1,24 @@ + + + + + gitea + + + + Authorization + token ${env.GITEA_TOKEN} + + + + + + diff --git a/.gitea/workflows/publish-maven.yml b/.gitea/workflows/publish-maven.yml new file mode 100644 index 0000000..1952e48 --- /dev/null +++ b/.gitea/workflows/publish-maven.yml @@ -0,0 +1,37 @@ +name: Publish Maven packages + +# Flash's own POM keeps `2.1.0-SNAPSHOT` as its committed version — that's what local +# `mvn install` (Pathway's normal dev loop, see its pom.xml `flash.version` comment) always +# produces, and changing it here would break that. Gitea's Maven registry, unlike a real +# snapshot repository, refuses to re-publish an existing name+version (must delete first — +# see https://docs.gitea.com/usage/packages/maven#publish-a-package), so every push instead +# publishes under a throwaway version stamped with the commit it built from +# (`2.1.0-`), via `versions:set` on a checkout copy — never touching the committed +# POMs. Consumers (Pathway's `docker` Maven profile) pin `flash.version` to one specific +# published build and bump it by hand to pick up newer Flash changes; see +# pathway/pom.xml's `docker` profile for the other half of this. +on: + push: + branches: [master] + +jobs: + publish: + runs-on: docker + container: + image: maven:3.9-eclipse-temurin-21 + steps: + - uses: actions/checkout@v4 + + - name: Stamp every module with a commit-scoped version + run: | + SHORT_SHA=$(git rev-parse --short HEAD) + mvn -B versions:set -DnewVersion="2.1.0-${SHORT_SHA}" -DprocessAllModules=true -DgenerateBackupPoms=false + echo "Publishing as 2.1.0-${SHORT_SHA}" + + - name: Deploy to the Gitea Maven registry + env: + GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} + run: | + mvn -B -s .gitea/maven-settings.xml -DskipTests deploy \ + -DaltReleaseDeploymentRepository=gitea::https://git.pixel-services.com/api/packages/Relism/maven \ + -DaltSnapshotDeploymentRepository=gitea::https://git.pixel-services.com/api/packages/Relism/maven -- 2.54.0