-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: SDK-1407 support self-serve sources publishing (#659)
- Loading branch information
Showing
3 changed files
with
60 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Generate and Publish Sources | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
version: | ||
description: 'SDK Version - A semantic SDK version, e.g., 1.0.0 or 1.0.0-SNAPSHOT' | ||
required: true | ||
type: string | ||
path: | ||
description: 'Path to publish the source code to. This should be a path of a directory where the source code will be published to' | ||
required: true | ||
type: string | ||
sdk_key: | ||
description: 'Key to the generated SDK artifact' | ||
default: 'sdk' | ||
type: string | ||
specs_key: | ||
description: 'Key to the transformed and ready to publish specs artifact and name (without extension, e.g. specs, the file is expected to have the extension .yaml)' | ||
default: 'transformedSpecs' | ||
type: string | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: ${{ inputs.sdk_key }} | ||
path: sdk-repo/generator/${{ inputs.sdk_key }} | ||
|
||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: ${{ inputs.specs_key }} | ||
path: . | ||
|
||
- name: Add generated source code to the path | ||
run: | | ||
rm -rf ${{ inputs.path }} | ||
mkdir -p ${{ inputs.path }} | ||
cp -r ./sdk-repo/generator/sdk/src ${{ inputs.path }}/src | ||
cp ./sdk-repo/generator/sdk/pom.xml ${{ inputs.path }}/src | ||
cp ./sdk-repo/generator/sdk/README.md ${{ inputs.path }}/src | ||
cp ./${{ inputs.specs_key }}.yaml ${{ inputs.path }}/${{ inputs.specs_key }}.yaml | ||
- name: Create PR | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
branch: "publish-v${{ inputs.version }}" | ||
commit-message: "chore: Publish v${{ inputs.version }}" | ||
title: "chore: Publish v${{ inputs.version }}" | ||
body: | | ||
This PR publishes the source code for v${{ inputs.version }}, generated by the SDK generator. | ||
add-paths: | | ||
${{ inputs.path }}/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters