Skip to content

Commit

Permalink
add github action to publish releases
Browse files Browse the repository at this point in the history
  • Loading branch information
cwensel committed May 10, 2024
1 parent 65e5a3e commit 5fd3aec
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 4 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/publish-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Publish Release

on:
push:
branches:
- 'wip-[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+'

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Set Build Number Environment Variable
env:
BUILD_NUMBER_OFFSET: 26
run: |
echo "BUILD_NUMBER=$((${{ github.run_number }} + $BUILD_NUMBER_OFFSET))" >> "$GITHUB_ENV"
- name: Install gpg secret key
run: |
cat <(echo -e "${{ secrets.GPG_SECRET_KEY }}") | gpg2 --batch --import
gpg2 --list-secret-keys --keyid-format LONG
- uses: actions/checkout@v2

- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: 8
distribution: 'zulu'

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build and Test
run: ./gradlew clean check

- name: Publish WIP to Github Packages
if: ${{ contains( github.ref, 'wip-' ) }}
env:
GRADLE_OPTS: -Dbuild.number=${{ env.BUILD_NUMBER}} -Dbuild.vcs.number=${{ github.sha }} -Dbuild.vcs.branch=${{ github.ref }}
GPR_USERNAME: ${{ github.actor }}
GPR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew publishAllPublicationsToGitHubPackagesRepository -Psigning.gnupg.keyName=${{ secrets.GPG_SECRET_KEY_ID }} -Psigning.gnupg.passphrase=${{ secrets.GPG_SECRET_KEY_PASSWORD }}

- name: Publish Release to Maven Central
if: ${{ !contains( github.ref, 'wip-' ) }}
env:
GRADLE_OPTS: -Dbuild.number=${{ env.BUILD_NUMBER}} -Dbuild.vcs.number=${{ github.sha }} -Dbuild.vcs.branch=${{ github.ref }}
MCR_USERNAME: ${{ secrets.MCR_USERNAME }}
MCR_PASSWORD: ${{ secrets.MCR_PASSWORD }}
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository -Psigning.gnupg.keyName=${{ secrets.GPG_SECRET_KEY_ID }} -Psigning.gnupg.passphrase=${{ secrets.GPG_SECRET_KEY_PASSWORD }}
11 changes: 7 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import java.text.SimpleDateFormat

/*
* Copyright (c) 2007-2022 The Cascading Authors. All Rights Reserved.
* Copyright (c) 2007-2024 The Cascading Authors. All Rights Reserved.
*
* Project and contact information: https://cascading.wensel.net/
*
Expand All @@ -20,6 +18,10 @@ import java.text.SimpleDateFormat
* limitations under the License.
*/

import java.text.SimpleDateFormat



/*
Using:
Expand Down Expand Up @@ -235,6 +237,7 @@ subprojects {
}

signing {
useGpgCmd()
sign publishing.publications.maven
}

Expand Down Expand Up @@ -437,4 +440,4 @@ def resolveTests( Project project )
dependencies.create( project ) {
capabilities {requireCapability( "$project.group:$project.name-test" )}
}
}
}

0 comments on commit 5fd3aec

Please sign in to comment.