Skip to content

Commit c64ae6b

Browse files
committed
generated java job
Signed-off-by: yue9944882 <[email protected]>
1 parent 25e2656 commit c64ae6b

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

.github/workflows/generate.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Generate
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
kubernetesBranch:
7+
type: string
8+
required: true
9+
description: 'The remote kubernetes release branch to fetch openapi spec. .e.g. "release-1.23"'
10+
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout Java
17+
uses: actions/checkout@v3
18+
- name: Checkout Gen
19+
uses: actions/checkout@v3
20+
with:
21+
path: gen
22+
repository: kubernetes-client/gen
23+
token: ${{ secrets.PAT_TOKEN }}
24+
- name: Generate Branch Name
25+
run: |
26+
SUFFIX=$(openssl rand -hex 4)
27+
echo "BRANCH=automated-generate-$SUFFIX" >> $GITHUB_ENV
28+
- name: Generate
29+
run: |
30+
cd gen/openapi
31+
cat <<"EOF"> settings
32+
# Kubernetes branch to get the OpenAPI spec from.
33+
export KUBERNETES_BRANCH="${{ github.event.inputs.kubernetesBranch }}"
34+
35+
# client version for packaging and releasing. It can
36+
# be different than SPEC_VERSION.
37+
export CLIENT_VERSION=$(mvn -q \
38+
-Dexec.executable="echo" \
39+
-Dexec.args='${project.version}' \
40+
--non-recursive \
41+
org.codehaus.mojo:exec-maven-plugin:1.6.0:exec)
42+
43+
export PACKAGE_NAME="io.kubernetes.client.openapi"
44+
EOF
45+
46+
bash java.sh ../../kubernetes/ settings
47+
cd ../../
48+
git config user.email "[email protected]"
49+
git config user.name "Kubernetes Prow Robot"
50+
git checkout -b "$BRANCH"
51+
git add .
52+
git commit -s -m 'Automated openapi generation from ${{ github.event.inputs.kubernetesBranch }}'
53+
git push origin "$BRANCH"
54+
- name: Pull Request
55+
uses: repo-sync/pull-request@v2
56+
with:
57+
source_branch: ${{ env.BRANCH }}
58+
destination_branch: ${{ github.ref_name }}
59+
github_token: ${{ secrets.GITHUB_TOKEN }}
60+
pr_title: "Automated Generate from openapi ${{ github.event.inputs.kubernetesBranch }}"
61+
62+
63+
64+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
*/target/
1212
target/
1313
**/.factorypath
14+
gen/**
1415

1516
# Mobile Tools for Java (J2ME)
1617
.mtj.tmp/

0 commit comments

Comments
 (0)