Fixed workflow error. #7
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Maven Package And Publish To Maven Central | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
- 'v*.*.*-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' | |
- 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: Import GPG private key | |
run: | | |
echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import | |
- name: Publish to the Maven Central Repository | |
run: | | |
mvn --batch-mode deploy | |
env: | |
GPG_PASSPHRASE: ${{ secrets.SIGNING_PASSWORD }} | |
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} |