Skip to content

Commit

Permalink
Publish releases via GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
MrStahlfelge committed Feb 5, 2021
1 parent 3878b76 commit 0dfdf52
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
33 changes: 33 additions & 0 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Compile and publish release

on:
release:
types: [published]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build and test
run: ./gradlew clean ashley:test
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v3
with:
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Release build deploy
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
run:
./gradlew clean uploadArchives -PRELEASE=true -Psigning.gnupg.keyId=${{ secrets.GPG_KEYID }} -Psigning.gnupg.passphrase=${{ secrets.GPG_PASSPHRASE }} -Psigning.gnupg.keyName=${{ secrets.GPG_KEYID }}
3 changes: 2 additions & 1 deletion publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def sonatypeRepositoryUrl
//set build variables based on build type (release, continuous integration, development)
if(hasProperty("RELEASE")) {
isReleaseBuild = true
sonatypeRepositoryUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
sonatypeRepositoryUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
println "Performing release build"
} else if (hasProperty("SNAPSHOT")) {
isCiBuild = true
Expand Down Expand Up @@ -56,6 +56,7 @@ artifacts {

if(isReleaseBuild) {
signing {
useGpgCmd()
sign configurations.archives
}
} else {
Expand Down

0 comments on commit 0dfdf52

Please sign in to comment.