Skip to content

Cherrypick #2197 to release-15 #2205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
generated java job
Signed-off-by: yue9944882 <[email protected]>
  • Loading branch information
yue9944882 committed Apr 7, 2022
commit c64ae6b0be8bda28586d6f8ba02dcf128d1d547b
64 changes: 64 additions & 0 deletions .github/workflows/generate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Generate

on:
workflow_dispatch:
inputs:
kubernetesBranch:
type: string
required: true
description: 'The remote kubernetes release branch to fetch openapi spec. .e.g. "release-1.23"'


jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout Java
uses: actions/checkout@v3
- name: Checkout Gen
uses: actions/checkout@v3
with:
path: gen
repository: kubernetes-client/gen
token: ${{ secrets.PAT_TOKEN }}
- name: Generate Branch Name
run: |
SUFFIX=$(openssl rand -hex 4)
echo "BRANCH=automated-generate-$SUFFIX" >> $GITHUB_ENV
- name: Generate
run: |
cd gen/openapi
cat <<"EOF"> settings
# Kubernetes branch to get the OpenAPI spec from.
export KUBERNETES_BRANCH="${{ github.event.inputs.kubernetesBranch }}"

# client version for packaging and releasing. It can
# be different than SPEC_VERSION.
export CLIENT_VERSION=$(mvn -q \
-Dexec.executable="echo" \
-Dexec.args='${project.version}' \
--non-recursive \
org.codehaus.mojo:exec-maven-plugin:1.6.0:exec)

export PACKAGE_NAME="io.kubernetes.client.openapi"
EOF

bash java.sh ../../kubernetes/ settings
cd ../../
git config user.email "[email protected]"
git config user.name "Kubernetes Prow Robot"
git checkout -b "$BRANCH"
git add .
git commit -s -m 'Automated openapi generation from ${{ github.event.inputs.kubernetesBranch }}'
git push origin "$BRANCH"
- name: Pull Request
uses: repo-sync/pull-request@v2
with:
source_branch: ${{ env.BRANCH }}
destination_branch: ${{ github.ref_name }}
github_token: ${{ secrets.GITHUB_TOKEN }}
pr_title: "Automated Generate from openapi ${{ github.event.inputs.kubernetesBranch }}"




1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/target/
target/
**/.factorypath
gen/**

# Mobile Tools for Java (J2ME)
.mtj.tmp/
Expand Down