-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add: GitHub action publish on central portal (#14)
* fix: test publish * fix: Inappropriate ioctl for device * fix: force * fix: user missed * fix: username missed * fix: simple * fix: change version * fix: build * fix: test using 1.7.0 * test: https://central.sonatype.org/publish/publish-portal-maven/#introduction * Revert "test: https://central.sonatype.org/publish/publish-portal-maven/#introduction" This reverts commit b418dc8. * Revert "Revert "test: https://central.sonatype.org/publish/publish-portal-maven/#introduction"" This reverts commit 17ce345. * fix: publish * fix: release * fix: prepare release
- Loading branch information
Showing
2 changed files
with
63 additions
and
34 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created | ||
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path | ||
|
||
name: Maven Package | ||
|
||
on: | ||
|
@@ -9,27 +6,63 @@ on: | |
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '11' | ||
distribution: 'temurin' | ||
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml | ||
settings-path: ${{ github.workspace }} # location for the settings.xml file | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '11' | ||
distribution: 'temurin' | ||
server-id: ossrh | ||
settings-path: ${{ github.workspace }} | ||
|
||
- name: Import GPG key | ||
env: | ||
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | ||
run: | | ||
echo "$GPG_PRIVATE_KEY" | gpg --batch --yes --import | ||
gpg --list-secret-keys | ||
- name: Verify GPG Passphrase | ||
env: | ||
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | ||
run: | | ||
echo "test message" | gpg --batch --yes --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" --sign --local-user [email protected] | ||
- name: Set up Maven settings | ||
run: | | ||
mkdir -p ~/.m2 | ||
echo "<settings> | ||
<servers> | ||
<server> | ||
<id>central</id> | ||
<username>${{ secrets.OSSRH_USERNAME }}</username> | ||
<password>${{ secrets.OSSRH_PASSWORD }}</password> | ||
</server> | ||
</servers> | ||
<profiles> | ||
<profile> | ||
<id>gpg-sign</id> | ||
<properties> | ||
<gpg.executable>gpg</gpg.executable> | ||
<gpg.keyname>[email protected]</gpg.keyname> | ||
<gpg.passphrase>${{ secrets.GPG_PASSPHRASE }}</gpg.passphrase> | ||
</properties> | ||
</profile> | ||
</profiles> | ||
<activeProfiles> | ||
<activeProfile>gpg-sign</activeProfile> | ||
</activeProfiles> | ||
</settings>" > ~/.m2/settings.xml | ||
- name: Build with Maven | ||
run: mvn -B package --file pom.xml | ||
|
||
- name: Publish to GitHub Packages Apache Maven | ||
run: mvn deploy | ||
env: | ||
GITHUB_USERNAME: ${{ secrets.GITHUB_USERNAME }} | ||
GITHUB_TOKEN: ${{ github.token }} | ||
- name: Publish to OSSRH | ||
run: mvn deploy | ||
env: | ||
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | ||
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} |
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