Skip to content

Commit

Permalink
feat: SDK-1407 support self-serve sources publishing (#659)
Browse files Browse the repository at this point in the history
  • Loading branch information
mohnoor94 authored Aug 12, 2024
1 parent 9dcdfc9 commit ad0cfd7
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/selfserve-generate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
type: string
specs_key:
description: 'Key to the transformed and ready to use specs artifact and name (without extension, e.g. specs, the file is expected to have the extension .yaml)'
default: 'specs'
default: 'transformedSpecs'
type: string
sdk_key:
description: 'Key to the generated SDK artifact'
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/selfserve-publish-sources.yaml
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 }}/*
4 changes: 2 additions & 2 deletions .github/workflows/selfserve-transform-specs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ on:
type: string
required: true
transformed_specs_key:
description: 'Key to the transformed specs artifact and name (without extension, e.g. tspecs, the file is expected to have the extension .yaml)'
description: 'Key to the transformed specs artifact and name (without extension, e.g. transformedSpecs, the file is expected to have the extension .yaml)'
type: string
default: 'tspecs'
default: 'transformedSpecs'

jobs:
transform-specs:
Expand Down

0 comments on commit ad0cfd7

Please sign in to comment.