Merge pull request #2 from sneakybugmaster/claude/bold-brahmagupta-nsa7hh

Add Gitea workflow to publish the library to the public Maven registry
This commit is contained in:
thinh authored and GitHub committed 2026-10-12 11:23:20 +07:00
commit f092847fc2
4 files changed
+84

No files matched your search

+46
View File
@@ -0,0 +1,46 @@
# Builds, tests and publishes the library modules (parent, core, autoconfigure, starter) to the Gitea Maven
# registry of the "public" owner. The demo app is not published.
#
# push to main -> <version>-SNAPSHOT from pom.xml
# tag v1.2.3 -> release 1.2.3
# manual run -> whatever pom.xml says
#
# Needs the repository/organization secret REGISTRY_TOKEN: a Gitea access token with "write:package" scope.
name: Publish
on:
push:
branches: [main]
tags: ['v*']
workflow_dispatch:
env:
REGISTRY_URL: ${{ gitea.server_url }}/api/packages/public/maven
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '27'
cache: maven
# writes ~/.m2/settings.xml with a <server id="gitea"> reading these env vars
server-id: gitea
server-username: REGISTRY_USERNAME
server-password: REGISTRY_TOKEN
- name: Set release version from tag
if: startsWith(gitea.ref, 'refs/tags/v')
run: mvn -B -ntp versions:set -DnewVersion="${GITEA_REF_NAME#v}" -DgenerateBackupPoms=false
env:
GITEA_REF_NAME: ${{ gitea.ref_name }}
- name: Build, test and publish
run: mvn -B -ntp deploy -DaltDeploymentRepository="gitea::${REGISTRY_URL}"
env:
REGISTRY_USERNAME: ${{ gitea.actor }}
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
+23
View File
@@ -19,6 +19,29 @@ mvn verify
| `mailsender-pgp-spring-boot-starter` | dependency bundle for applications |
| `mailsender-demo` | sample app that sends test mails |
## Installation
Releases and snapshots are published to the Gitea Maven registry of the `public` owner by
`.gitea/workflows/publish.yml` (push to `main` → `-SNAPSHOT`, tag `v1.2.3` → `1.2.3`):
```xml
<repositories>
<repository>
<id>gitea-public</id>
<url>https://YOUR-GITEA-HOST/api/packages/public/maven</url>
</repository>
</repositories>
<dependency>
<groupId>pro.thinhha.mailsender</groupId>
<artifactId>mailsender-pgp-spring-boot-starter</artifactId>
<version>0.1.0</version>
</dependency>
```
If the packages are not public, add a `<server>` with id `gitea-public` and a token with `read:package` scope to
your `settings.xml`.
## Usage
Add `pro.thinhha.mailsender:mailsender-pgp-spring-boot-starter`, configure `spring.mail.*` as usual, and send
+5
View File
@@ -13,6 +13,11 @@
<artifactId>mailsender-demo</artifactId>
<description>Demo app: looks up the recipient's WKD key and sends test e-mails</description>
<properties>
<!-- sample app, not a library: never published -->
<maven.deploy.skip>true</maven.deploy.skip>
</properties>
<dependencies>
<dependency>
<groupId>pro.thinhha.mailsender</groupId>
+10
View File
@@ -93,6 +93,16 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.4</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.18.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>