Skip to content

Commit e3696e0

Browse files
author
Anonymous Committer
committed
Improve release workflows
1 parent 3b3bdef commit e3696e0

4 files changed

Lines changed: 46 additions & 14 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,20 @@ on:
99
jobs:
1010
build:
1111
runs-on: ubuntu-latest
12+
env:
13+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
1214

1315
steps:
1416
- name: Checkout
15-
uses: actions/checkout@v4
17+
uses: actions/checkout@v5
1618

1719
- name: Set up Python
18-
uses: actions/setup-python@v5
20+
uses: actions/setup-python@v6
1921
with:
2022
python-version: "3.11"
2123

2224
- name: Set up Java
23-
uses: actions/setup-java@v4
25+
uses: actions/setup-java@v5
2426
with:
2527
distribution: temurin
2628
java-version: "21"
@@ -34,4 +36,3 @@ jobs:
3436

3537
- name: Build and test
3638
run: mvn -B verify
37-

.github/workflows/release.yml

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,36 @@ on:
44
push:
55
tags:
66
- "v*"
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: "Existing Git tag to publish, for example v0.1.0"
11+
required: true
12+
default: "v0.1.0"
713

814
jobs:
915
publish:
1016
runs-on: ubuntu-latest
1117
permissions:
1218
contents: write
19+
env:
20+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
21+
RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
1322

1423
steps:
1524
- name: Checkout
16-
uses: actions/checkout@v4
25+
uses: actions/checkout@v5
26+
with:
27+
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref }}
28+
fetch-depth: 0
1729

1830
- name: Set up Python
19-
uses: actions/setup-python@v5
31+
uses: actions/setup-python@v6
2032
with:
2133
python-version: "3.11"
2234

2335
- name: Set up Java
24-
uses: actions/setup-java@v4
36+
uses: actions/setup-java@v5
2537
with:
2638
distribution: temurin
2739
java-version: "21"
@@ -33,6 +45,24 @@ jobs:
3345
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
3446
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
3547

48+
- name: Validate release secrets
49+
env:
50+
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
51+
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
52+
MAVEN_GPG_PRIVATE_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
53+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
54+
run: |
55+
missing=()
56+
for secret_name in MAVEN_CENTRAL_USERNAME MAVEN_CENTRAL_PASSWORD MAVEN_GPG_PRIVATE_KEY MAVEN_GPG_PASSPHRASE; do
57+
if [ -z "${!secret_name}" ]; then
58+
missing+=("$secret_name")
59+
fi
60+
done
61+
if [ "${#missing[@]}" -gt 0 ]; then
62+
echo "Missing required GitHub secrets: ${missing[*]}" >&2
63+
exit 1
64+
fi
65+
3666
- name: Import GPG key
3767
uses: crazy-max/ghaction-import-gpg@v6
3868
with:
@@ -56,5 +86,5 @@ jobs:
5686
- name: Create GitHub Release
5787
uses: softprops/action-gh-release@v2
5888
with:
89+
tag_name: ${{ env.RELEASE_TAG }}
5990
generate_release_notes: true
60-

.github/workflows/sync-openapi.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,20 @@ jobs:
1111
permissions:
1212
contents: write
1313
pull-requests: write
14+
env:
15+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
1416

1517
steps:
1618
- name: Checkout
17-
uses: actions/checkout@v4
19+
uses: actions/checkout@v5
1820

1921
- name: Set up Python
20-
uses: actions/setup-python@v5
22+
uses: actions/setup-python@v6
2123
with:
2224
python-version: "3.11"
2325

2426
- name: Set up Java
25-
uses: actions/setup-java@v4
27+
uses: actions/setup-java@v5
2628
with:
2729
distribution: temurin
2830
java-version: "21"
@@ -52,4 +54,3 @@ jobs:
5254
labels: |
5355
automation
5456
openapi
55-

docs/publishing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ The release workflow publishes this SDK to Maven Central through Sonatype Centra
2323
3. Update `CHANGELOG.md`.
2424
4. Commit the release metadata changes.
2525
5. Create and push a matching tag, for example `v0.1.0`.
26-
6. The `release.yml` workflow will run `mvn -Prelease deploy` and create the GitHub Release once Central publishing succeeds.
26+
6. Push a matching tag, or use the `Release` workflow's manual dispatch with an existing tag after secrets are configured.
27+
7. The `release.yml` workflow will run `mvn -Prelease deploy` and create the GitHub Release once Central publishing succeeds.
2728

2829
## Local Dry Run
2930

@@ -32,4 +33,3 @@ python3 scripts/sync_sdk.py --skip-fetch --check
3233
python3 -m unittest discover -s scripts/tests
3334
mvn verify
3435
```
35-

0 commit comments

Comments
 (0)