Skip to content

Commit 5ca9e84

Browse files
authored
Merge pull request #118 from authzed/fix-publish-step-to-strip-v
Fix publish step to strip v from version
2 parents 303748e + a2110cd commit 5ca9e84

File tree

1 file changed

+40
-32
lines changed

1 file changed

+40
-32
lines changed

.github/workflows/publish.yaml

+40-32
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,46 @@
1+
---
12
name: "Publish to Maven"
2-
on:
3-
push:
4-
tags:
5-
- '*'
3+
on: # yamllint disable-line rule:truthy
4+
release:
5+
types:
6+
- "published"
67
jobs:
78
publish:
89
name: "Publish to Maven"
910
runs-on: "ubuntu-latest"
1011
steps:
11-
- uses: "actions/checkout@v4"
12-
- uses: "actions/setup-java@v4"
13-
with:
14-
distribution: "adopt"
15-
java-package: "jdk"
16-
java-version: "17" # LTS
17-
- uses: "bufbuild/buf-setup-action@v1"
18-
with:
19-
version: "1.18.0"
20-
github_token: ${{ github.token }}
21-
- name: "Publish to Sonatype"
22-
env:
23-
ORG_GRADLE_PROJECT_signingKey: "${{ secrets.SIGNING_KEY_ARMORED }}"
24-
ORG_GRADLE_PROJECT_signingPassword: "${{ secrets.SIGNING_PASSWORD }}"
25-
ORG_GRADLE_PROJECT_sonatypeUsername: "${{ secrets.SONATYPE_USERNAME }}"
26-
ORG_GRADLE_PROJECT_sonatypePassword: "${{ secrets.SONATYPE_PASSWORD }}"
27-
run: |
28-
export ORG_GRADLE_PROJECT_release=${GITHUB_REF#refs/tags/}
29-
./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
30-
- name: Publish JavaDoc
31-
uses: MathieuSoysal/[email protected]
32-
with:
33-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34-
javadoc-branch: javadoc
35-
java-version: 17
36-
project: gradle
37-
target-folder: docs
38-
custom-command: gradle javadoc -Prelease=${GITHUB_REF#refs/tags/}
12+
- uses: "actions/checkout@v4"
13+
- uses: "actions/setup-java@v4"
14+
with:
15+
distribution: "adopt"
16+
java-package: "jdk"
17+
java-version: "17" # LTS
18+
- uses: "bufbuild/buf-setup-action@v1"
19+
with:
20+
version: "1.18.0"
21+
github_token: ${{ github.token }}
22+
# Store the version, stripping any v-prefix
23+
# This lets us use v-prefixed releases
24+
- name: Write release version
25+
run: |
26+
VERSION=${GITHUB_REF_NAME#v}
27+
echo Version: $VERSION
28+
echo "VERSION=$VERSION" >> $GITHUB_ENV
29+
- name: "Publish to Sonatype"
30+
env:
31+
ORG_GRADLE_PROJECT_signingKey: "${{ secrets.SIGNING_KEY_ARMORED }}"
32+
ORG_GRADLE_PROJECT_signingPassword: "${{ secrets.SIGNING_PASSWORD }}"
33+
ORG_GRADLE_PROJECT_sonatypeUsername: "${{ secrets.SONATYPE_USERNAME }}"
34+
ORG_GRADLE_PROJECT_sonatypePassword: "${{ secrets.SONATYPE_PASSWORD }}"
35+
run: |
36+
export ORG_GRADLE_PROJECT_release=${VERSION}
37+
./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
38+
- name: Publish JavaDoc
39+
uses: MathieuSoysal/[email protected]
40+
with:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
javadoc-branch: javadoc
43+
java-version: 17
44+
project: gradle
45+
target-folder: docs
46+
custom-command: gradle javadoc -Prelease=${VERSION}

0 commit comments

Comments
 (0)