-
Notifications
You must be signed in to change notification settings - Fork 2
94 lines (80 loc) · 2.94 KB
/
github-actions.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# This workflow will build the project, run integration tests, and release.
# Because secrets are not available on external forks, this job is expected to fail
# on external pull requests.
name: Build, Check, Publish
on:
push:
branches: [ v1 ]
paths-ignore:
- '.github/workflows/**'
pull_request:
branches: [ v1 ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Build SDK
run: ./run-build
- name: Ensure no changes in Generated Code
run: ./bin/check-clean-git-status
# This job runs on merging to "v1" branch
# Builds and publishes package
publish-prod:
runs-on: ubuntu-latest
if: >-
github.repository == 'hellosign/dropbox-sign-java'
&& github.ref == 'refs/heads/v1'
&& github.event_name != 'pull_request'
needs: [ build ]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install JDK 11
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
- name: Upload Artifacts
run: ./gradlew publishAllPublicationsToMavenCentralRepository --no-daemon --no-parallel --no-configuration-cache --stacktrace
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
- name: Retrieve version
run: echo "PACKAGE_VERSION=$(cat VERSION)" >> $GITHUB_ENV
- name: Publish Release to Maven Central
run: ./gradlew closeAndReleaseRepository --no-daemon --no-parallel
if: "!endsWith(env.PACKAGE_VERSION, '-SNAPSHOT')"
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
# This job runs on merging to "v1" branch
# Creates a new tag using the value in the VERSION file
cut-tag:
runs-on: ubuntu-latest
if: >-
github.repository == 'hellosign/dropbox-sign-java'
&& github.ref == 'refs/heads/v1'
&& github.event_name != 'pull_request'
needs: [ publish-prod ]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Retrieve version
run: echo "PACKAGE_VERSION=$(cat VERSION)" >> $GITHUB_ENV
- name: Create tag
uses: actions/github-script@v6
if: "!endsWith(env.PACKAGE_VERSION, '-SNAPSHOT')"
env:
PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }}
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/" + process.env.PACKAGE_VERSION,
sha: context.sha
})