mirror of
https://github.com/sneakybugmaster/mailsender.git
synced 2026-11-10 19:48:49 +00:00
- .gitea/workflows/publish.yml: build, test and deploy on push to main (snapshot), on v* tags (release version from the tag) and manually; authenticates with the REGISTRY_TOKEN secret - demo app is excluded from deployment - pin maven-deploy-plugin and versions-maven-plugin - README: how to consume the package Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G71TQ5jDETVwdUJxGAwaiT
47 lines
1.5 KiB
YAML
47 lines
1.5 KiB
YAML
# 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 }}
|