-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (99 loc) · 3.33 KB
/
Copy pathpublish-java-sdk.yaml
File metadata and controls
114 lines (99 loc) · 3.33 KB
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: Publish Java SDK
run-name: Publish Java SDK ${{ inputs.version }} (${{ inputs.caller_run_id || github.run_id }})
on:
workflow_call:
inputs:
version:
description: "Version to publish (for example: 1.0.0 or 1.0.0-SNAPSHOT)"
required: true
type: string
caller_run_id:
description: Identifier used by the aggregate publishing workflow
required: false
type: string
secrets:
REPO_USERNAME:
required: true
REPO_PASSWORD:
required: true
workflow_dispatch:
inputs:
version:
description: "Version to publish (for example: 1.0.0 or 1.0.0-SNAPSHOT)"
required: true
type: string
caller_run_id:
description: Identifier used by the aggregate publishing workflow
required: false
type: string
permissions:
contents: read
concurrency:
group: publish-java-sdk
cancel-in-progress: false
jobs:
publish:
name: Publish to repo.azisaba.net
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up pnpm
uses: pnpm/action-setup@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 24
package-manager-cache: false
- name: Set up Java
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 21
server-id: azisaba
server-username: REPO_USERNAME
server-password: REPO_PASSWORD
- name: Install generator dependencies
run: pnpm install --frozen-lockfile
- name: Generate Java SDK
env:
VERSION: ${{ inputs.version }}
run: |
pnpm exec rimraf sdks/java/generated
pnpm exec openapi-generator-cli generate \
-c sdks/java/config.yaml \
--additional-properties artifactVersion="$VERSION"
node sdks/java/postprocess.ts
- name: Validate package metadata
env:
VERSION: ${{ inputs.version }}
working-directory: sdks/java/generated
run: |
actual_version="$(node -e '
const { readFileSync } = require("node:fs");
const match = readFileSync("pom.xml", "utf8").match(/<project[\s\S]*?<version>([^<]+)<\/version>/);
if (!match) process.exit(1);
process.stdout.write(match[1]);
')"
echo "Expected version: $VERSION"
echo "Generated version: $actual_version"
test "$actual_version" = "$VERSION"
- name: Build Java SDK
working-directory: sdks/java/generated
run: mvn --batch-mode --no-transfer-progress verify
- name: Publish Java SDK
env:
REPO_USERNAME: ${{ secrets.REPO_USERNAME }}
REPO_PASSWORD: ${{ secrets.REPO_PASSWORD }}
VERSION: ${{ inputs.version }}
working-directory: sdks/java/generated
run: |
if [[ "$VERSION" == *-SNAPSHOT ]]; then
repository_url="https://repo.azisaba.net/repository/maven-snapshots/"
else
repository_url="https://repo.azisaba.net/repository/maven-releases/"
fi
mvn --batch-mode --no-transfer-progress deploy \
-DskipTests \
-DaltDeploymentRepository="azisaba::$repository_url"