40 lines
1.1 KiB
YAML
40 lines
1.1 KiB
YAML
name: Deploy to Maven Repository
|
|
|
|
on:
|
|
release:
|
|
types: [published]
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up JDK
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: 'temurin'
|
|
java-version: '21'
|
|
cache: 'maven'
|
|
# Writes a <server id="smr"> entry to ~/.m2/settings.xml that reads the credentials from these env vars
|
|
server-id: smr
|
|
server-username: MAVEN_DEPLOY_USER
|
|
server-password: MAVEN_DEPLOY_TOKEN
|
|
|
|
- name: Set up Maven
|
|
uses: stCarolas/setup-maven@v5
|
|
with:
|
|
maven-version: 3.9.6
|
|
|
|
- name: Set version from release tag
|
|
run: mvn -B versions:set -DnewVersion="${{ github.event.release.tag_name }}" -DgenerateBackupPoms=false
|
|
|
|
- name: Build and deploy
|
|
env:
|
|
MAVEN_DEPLOY_USER: ${{ vars.MAVEN_DEPLOY_USER }}
|
|
MAVEN_DEPLOY_TOKEN: ${{ secrets.MAVEN_DEPLOY_TOKEN }}
|
|
run: |
|
|
mvn -B -U clean deploy -DskipTests \
|
|
-DaltDeploymentRepository=smr::${{ vars.MAVEN_REPO_URL }} |