forked from scream3r/java-simple-serial-connector
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Github actions and repository secrets to create Maven Central dep…
…loyment
- Loading branch information
1 parent
6a61983
commit 70cc150
Showing
2 changed files
with
96 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Maven Central Relase | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
releaseVersion: | ||
description: 'Release version' | ||
required: false | ||
|
||
env: | ||
MAVEN_OPTS: -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn | ||
GITHUB_BOT_NAME: github-actions | ||
GITHUB_BOT_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com | ||
|
||
jobs: | ||
maven-central-release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: git config --global user.email "${GITHUB_BOT_EMAIL}" | ||
- run: git config --global user.name "${GITHUB_BOT_NAME}" | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: 11 | ||
distribution: adopt | ||
server-id: ossrh | ||
server-username: OSSRH_TOKEN_USERNAME | ||
server-password: OSSRH_TOKEN_PASSWORD | ||
gpg-private-key: ${{ secrets.JAVA_NATIVE_PGP_KEY }} | ||
gpg-passphrase: PGP_KEY_PASSPHRASE | ||
- name: Set release version if provided as input | ||
if: github.event.inputs.releaseVersion != '' | ||
run: echo "VERSIONS=-DreleaseVersion=${{ github.event.inputs.releaseVersion }}" >> $GITHUB_ENV | ||
- name: Publish artifacts to Maven Central | ||
run: mvn -B release:prepare release:perform -P package,maven-central-release ${VERSIONS} | ||
env: | ||
OSSRH_TOKEN_USERNAME: ${{ secrets.OSSRH_TOKEN_USERNAME }} | ||
OSSRH_TOKEN_PASSWORD: ${{ secrets.OSSRH_TOKEN_PASSWORD }} | ||
PGP_KEY_PASSPHRASE: ${{ secrets.JAVA_NATIVE_PGP_KEY_PASSPHRASE }} | ||
- name: Push changes back to repo | ||
run: git push && git push --tags --force |
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