Skip to content

Commit 3004f36

Browse files
committed
build: fix release
1 parent 818843a commit 3004f36

File tree

2 files changed

+85
-37
lines changed

2 files changed

+85
-37
lines changed

.github/workflows/publish.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Copyright 2026 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Publish
16+
17+
on:
18+
release:
19+
types: [published]
20+
21+
jobs:
22+
publish:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v5
27+
with:
28+
token: ${{ secrets.SYNCED_GITHUB_TOKEN_REPO }}
29+
30+
- uses: gradle/actions/wrapper-validation@v4
31+
32+
- name: Set up JDK 21
33+
uses: actions/setup-java@v4.7.1
34+
with:
35+
java-version: '21'
36+
distribution: 'adopt'
37+
38+
- name: Create .gpg key
39+
run: |
40+
echo $GPG_KEY_ARMOR | base64 --decode > ./release.asc
41+
gpg --quiet --output $GITHUB_WORKSPACE/release.gpg --dearmor ./release.asc
42+
43+
echo "Build and publish"
44+
sed -i -e "s,mavenCentralUsername=,mavenCentralUsername=$SONATYPE_TOKEN_USERNAME,g" gradle.properties
45+
SONATYPE_TOKEN_PASSWORD_ESCAPED=$(printf '%s\n' "$SONATYPE_TOKEN_PASSWORD" | sed -e 's/[\/&]/\\&/g')
46+
sed -i -e "s,mavenCentralPassword=,mavenCentralPassword=$SONATYPE_TOKEN_PASSWORD_ESCAPED,g" gradle.properties
47+
sed -i -e "s,signing.keyId=,signing.keyId=$GPG_KEY_ID,g" gradle.properties
48+
sed -i -e "s,signing.password=,signing.password=$GPG_PASSWORD,g" gradle.properties
49+
sed -i -e "s,signing.secretKeyRingFile=,signing.secretKeyRingFile=$GITHUB_WORKSPACE/release.gpg,g" gradle.properties
50+
51+
env:
52+
GPG_KEY_ARMOR: ${{ secrets.SYNCED_GPG_KEY_ARMOR }}
53+
GPG_KEY_ID: ${{ secrets.SYNCED_GPG_KEY_ID }}
54+
GPG_PASSWORD: ${{ secrets.SYNCED_GPG_KEY_PASSWORD }}
55+
SONATYPE_TOKEN_PASSWORD: ${{ secrets.SONATYPE_TOKEN_PASSWORD }}
56+
SONATYPE_TOKEN_USERNAME: ${{ secrets.SONATYPE_TOKEN }}
57+
58+
- name: Publish to MavenCentral
59+
run: ./gradlew publishToMavenCentral --warn --stacktrace
Lines changed: 26 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,34 @@
1-
name: Publish
1+
# Copyright 2026 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
214

315
on:
4-
release:
5-
types: [published]
16+
push:
17+
branches:
18+
- main
19+
20+
permissions:
21+
contents: write
22+
pull-requests: write
23+
24+
name: release-please
625

726
jobs:
8-
publish:
27+
release-please:
928
runs-on: ubuntu-latest
1029
steps:
11-
- name: Checkout
12-
uses: actions/checkout@v5
30+
- uses: googleapis/release-please-action@v4
1331
with:
1432
token: ${{ secrets.SYNCED_GITHUB_TOKEN_REPO }}
15-
16-
- uses: gradle/actions/wrapper-validation@v4
17-
18-
- name: Set up JDK 21
19-
uses: actions/setup-java@v4.7.1
20-
with:
21-
java-version: '21'
22-
distribution: 'adopt'
23-
24-
- name: Create .gpg key
25-
run: |
26-
echo $GPG_KEY_ARMOR | base64 --decode > ./release.asc
27-
gpg --quiet --output $GITHUB_WORKSPACE/release.gpg --dearmor ./release.asc
28-
29-
echo "Build and publish"
30-
sed -i -e "s,mavenCentralUsername=,mavenCentralUsername=$SONATYPE_TOKEN_USERNAME,g" gradle.properties
31-
SONATYPE_TOKEN_PASSWORD_ESCAPED=$(printf '%s\n' "$SONATYPE_TOKEN_PASSWORD" | sed -e 's/[\/&]/\\&/g')
32-
sed -i -e "s,mavenCentralPassword=,mavenCentralPassword=$SONATYPE_TOKEN_PASSWORD_ESCAPED,g" gradle.properties
33-
sed -i -e "s,signing.keyId=,signing.keyId=$GPG_KEY_ID,g" gradle.properties
34-
sed -i -e "s,signing.password=,signing.password=$GPG_PASSWORD,g" gradle.properties
35-
sed -i -e "s,signing.secretKeyRingFile=,signing.secretKeyRingFile=$GITHUB_WORKSPACE/release.gpg,g" gradle.properties
36-
37-
env:
38-
GPG_KEY_ARMOR: ${{ secrets.SYNCED_GPG_KEY_ARMOR }}
39-
GPG_KEY_ID: ${{ secrets.SYNCED_GPG_KEY_ID }}
40-
GPG_PASSWORD: ${{ secrets.SYNCED_GPG_KEY_PASSWORD }}
41-
SONATYPE_TOKEN_PASSWORD: ${{ secrets.SONATYPE_TOKEN_PASSWORD }}
42-
SONATYPE_TOKEN_USERNAME: ${{ secrets.SONATYPE_TOKEN }}
43-
44-
- name: Publish to MavenCentral
45-
run: ./gradlew publishToMavenCentral --warn --stacktrace
33+
config-file: release-please-config.json
34+
manifest-file: .release-please-manifest.json

0 commit comments

Comments
 (0)