Skip to content

Commit 5b04f58

Browse files
committed
add github action to publish releases
1 parent 65e5a3e commit 5b04f58

File tree

2 files changed

+61
-4
lines changed

2 files changed

+61
-4
lines changed
+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Publish Release
2+
3+
on:
4+
push:
5+
branches:
6+
- 'wip-[0-9]+.[0-9]+'
7+
- '[0-9]+.[0-9]+'
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Set Build Number Environment Variable
16+
env:
17+
BUILD_NUMBER_OFFSET: 26
18+
run: |
19+
echo "BUILD_NUMBER=$((${{ github.run_number }} + $BUILD_NUMBER_OFFSET))" >> "$GITHUB_ENV"
20+
21+
- name: Install gpg secret key
22+
run: |
23+
cat <(echo -e "${{ secrets.GPG_SECRET_KEY }}") | gpg2 --batch --import
24+
gpg2 --list-secret-keys --keyid-format LONG
25+
26+
- uses: actions/checkout@v2
27+
28+
- name: Set up JDK 8
29+
uses: actions/setup-java@v2
30+
with:
31+
java-version: 8
32+
distribution: 'zulu'
33+
34+
- name: Grant execute permission for gradlew
35+
run: chmod +x gradlew
36+
37+
- name: Build and Test
38+
run: ./gradlew clean check
39+
40+
- name: Publish WIP to Github Packages
41+
if: ${{ contains( github.ref, 'wip-' ) }}
42+
env:
43+
GRADLE_OPTS: -Dbuild.number=${{ env.BUILD_NUMBER }} -Dbuild.vcs.number=${{ github.sha }} -Dbuild.vcs.branch=${{ github.ref }}
44+
GPR_USERNAME: ${{ github.actor }}
45+
GPR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
run: ./gradlew publishAllPublicationsToGitHubPackagesRepository -Psigning.gnupg.keyName=${{ secrets.GPG_SECRET_KEY_ID }} -Psigning.gnupg.passphrase=${{ secrets.GPG_SECRET_KEY_PASSWORD }}
47+
48+
- name: Publish Release to Maven Central
49+
if: ${{ !contains( github.ref, 'wip-' ) }}
50+
env:
51+
GRADLE_OPTS: -Dbuild.number=${{ env.BUILD_NUMBER }} -Dbuild.vcs.number=${{ github.sha }} -Dbuild.vcs.branch=${{ github.ref }}
52+
MCR_USERNAME: ${{ secrets.MCR_USERNAME }}
53+
MCR_PASSWORD: ${{ secrets.MCR_PASSWORD }}
54+
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository -Psigning.gnupg.keyName=${{ secrets.GPG_SECRET_KEY_ID }} -Psigning.gnupg.passphrase=${{ secrets.GPG_SECRET_KEY_PASSWORD }}

build.gradle

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
import java.text.SimpleDateFormat
2-
31
/*
4-
* Copyright (c) 2007-2022 The Cascading Authors. All Rights Reserved.
2+
* Copyright (c) 2007-2024 The Cascading Authors. All Rights Reserved.
53
*
64
* Project and contact information: https://cascading.wensel.net/
75
*
@@ -20,6 +18,10 @@ import java.text.SimpleDateFormat
2018
* limitations under the License.
2119
*/
2220

21+
import java.text.SimpleDateFormat
22+
23+
24+
2325
/*
2426
Using:
2527
@@ -235,6 +237,7 @@ subprojects {
235237
}
236238

237239
signing {
240+
useGpgCmd()
238241
sign publishing.publications.maven
239242
}
240243

@@ -437,4 +440,4 @@ def resolveTests( Project project )
437440
dependencies.create( project ) {
438441
capabilities {requireCapability( "$project.group:$project.name-test" )}
439442
}
440-
}
443+
}

0 commit comments

Comments
 (0)