Skip to content

Merge pull request #20 from sunquakes/development #9

Merge pull request #20 from sunquakes/development

Merge pull request #20 from sunquakes/development #9

name: Maven Package And Publish Snapshot To Maven Central
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+-alpha'
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
server-id: sonatype-snapshots
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Extract Changelog
id: extract_changelog
run: |
# Set the delimiter
delimiter="---"
# Read the file and extract the first part
while read -r line
do
if [[ $line == "$delimiter" ]]
then
break
fi
echo $line >> release_body.md
done < "CHANGELOG.md"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body_path: release_body.md
draft: false
prerelease: false
- name: Publish package
run: |
mvn --batch-mode deploy
env:
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}