Skip to content

Commit bdcc247

Browse files
committed
Add publish-plugins.yml workflow
Issue gh-14
1 parent 3620233 commit bdcc247

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Publish Plugins
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
should-publish-plugins:
7+
description: Whether plugins should be published.
8+
required: true
9+
type: string
10+
project-version:
11+
description: The project version extracted from the current branch/tag, used to restrict running the workflow to publish plugins.
12+
required: true
13+
type: string
14+
outputs:
15+
plugins-published:
16+
description: Whether plugins were actually published.
17+
value: ${{ jobs.publish-plugins.outputs.plugins-published }}
18+
project-version:
19+
description: The project version extracted from the current branch/tag.
20+
value: ${{ jobs.publish-plugins.outputs.project-version }}
21+
secrets:
22+
GRADLE_ENTERPRISE_CACHE_USER:
23+
required: false
24+
GRADLE_ENTERPRISE_CACHE_PASSWORD:
25+
required: false
26+
GRADLE_ENTERPRISE_SECRET_ACCESS_KEY:
27+
required: false
28+
GRADLE_PUBLISH_KEY:
29+
required: false
30+
GRADLE_PUBLISH_SECRET:
31+
required: false
32+
GPG_PRIVATE_KEY:
33+
required: false
34+
GPG_PASSPHRASE:
35+
required: false
36+
37+
env:
38+
GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USER }}
39+
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
40+
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }}
41+
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }}
42+
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }}
43+
44+
jobs:
45+
publish-plugins:
46+
name: Publish Plugins
47+
if: ${{ inputs.should-publish-plugins == 'true' && !endsWith(inputs.project-version, '-SNAPSHOT') && !contains(inputs.project-version, '-RC') && !contains(inputs.project-version, '-M') }}
48+
runs-on: ubuntu-latest
49+
outputs:
50+
plugins-published: ${{ steps.plugins-published.outputs.result }}
51+
project-version: ${{ steps.project-version.outputs.version }}
52+
steps:
53+
- uses: actions/checkout@v4
54+
- name: Set up JDK 17
55+
uses: spring-io/spring-gradle-build-action@v2
56+
- name: Publish Plugins
57+
env:
58+
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }}
59+
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PASSPHRASE }}
60+
run: ./gradlew publishPlugins -Pgradle.publish.key="$GRADLE_PUBLISH_KEY" -Pgradle.publish.secret="$GRADLE_PUBLISH_SECRET" --stacktrace
61+
- id: plugins-published
62+
name: Plugins Published
63+
run: echo "result=true" >> $GITHUB_OUTPUT
64+
- id: project-version
65+
name: Extract Project Version
66+
run: echo "version=$(cat gradle.properties | grep 'version=' | awk -F'=' '{print $2}')" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)