-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Github actions for release and publish to maven central.
- Loading branch information
Michael Fuchs
committed
Apr 12, 2021
1 parent
5e12648
commit bc99219
Showing
3 changed files
with
100 additions
and
28 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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Publish package to the Maven Central Repository | ||
on: | ||
release: | ||
types: [created] | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set Version from Tag | ||
run: echo "CI_RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK 8 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '8' | ||
distribution: 'adopt' | ||
- name: Cache Gradle packages | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Publish package | ||
run: ./gradlew publish | ||
env: | ||
ORG_GRADLE_PROJECT_GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} | ||
ORG_GRADLE_PROJECT_GPG_SIGNING_KEY_PASSWORD: ${{ secrets.GPG_SIGNING_KEY_PASSWORD }} | ||
OSSRH_MAVEN_USERNAME: ${{ secrets.OSSRH_MAVEN_USERNAME }} | ||
OSSRH_MAVEN_PASSWORD: ${{ secrets.OSSRH_MAVEN_PASSWORD }} | ||
- name: Cleanup Gradle Cache | ||
run: | | ||
rm -f ~/.gradle/caches/modules-2/modules-2.lock | ||
rm -f ~/.gradle/caches/modules-2/gc.properties | ||
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,9 +1,14 @@ | ||
|
||
group 'org.example' | ||
version '1.0-SNAPSHOT' | ||
|
||
|
||
subprojects { | ||
// sourceCompatibility = 1.8 | ||
// targetCompatibility = 1.8 | ||
def releaseVersion = System.getenv("CI_RELEASE_VERSION") | ||
def runId = System.getenv("GITHUB_RUN_ID") | ||
|
||
version = releaseVersion != null ? releaseVersion | ||
: runId != null ? "build-${runId}-SNAPSHOT" | ||
: "LOCAL-SNAPSHOT" | ||
|
||
group 'de.fumix' | ||
} | ||
|
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