-
Notifications
You must be signed in to change notification settings - Fork 3
74 lines (66 loc) · 2.51 KB
/
selfserve-publish-sources.yaml
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
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
branch:
description: |
Branch to publish the source code to and create the PR from.
Defaults to "publish-v<<version>>"
default: ''
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'
default: 'code'
type: string
sdk_key:
description: 'Key to the generated SDK artifact'
default: 'sdk'
type: string
sdk_repo_key:
description: 'Key to the SDK repository artifact'
default: 'sdk-repo'
type: string
jobs:
publish-sources:
runs-on: ubuntu-latest
steps:
- name: Set branch name to publish to
run: |
if [ -z "${{ inputs.branch }}" ]; then
echo "branch=publish-v${{ inputs.version }}" >> $GITHUB_ENV
else
echo "branch=${{ inputs.branch }}" >> $GITHUB_ENV
fi
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: ${{ inputs.sdk_key }}
path: ${{ inputs.sdk_repo_key }}/${{ inputs.sdk_key }}
- uses: actions/download-artifact@v4
with:
name: transformedSpecs
path: .
- name: Add generated source code to the path
run: |
rm -rf ${{ inputs.path }}
mkdir -p ${{ inputs.path }}
cp -r ${{ inputs.sdk_repo_key }}/${{ inputs.sdk_key }}/src ${{ inputs.path }}/src
cp ${{ inputs.sdk_repo_key }}/${{ inputs.sdk_key }}/pom.xml ${{ inputs.path }}
cp ${{ inputs.sdk_repo_key }}/${{ inputs.sdk_key }}/README.md ${{ inputs.path }}
cp ${{ inputs.sdk_repo_key }}/${{ inputs.sdk_key }}/LICENSE-HEADER.txt ${{ inputs.path }}
cp ./transformedSpecs.yaml ${{ inputs.path }}/transformedSpecs.yaml
- name: Create PR
uses: peter-evans/create-pull-request@v7
with:
branch: ${{ env.branch }}
commit-message: "chore: Publish v${{ inputs.version }}"
title: "chore: Publish v${{ inputs.version }}"
body: |
This PR publishes the source code for `v${{ inputs.version }}` in the `${{ inputs.path }}` directory.
Generated by the EG SDK generator.
add-paths: |
${{ inputs.path }}/*