Skip to content

Commit d57fb61

Browse files
authored
Merge pull request #3 from DocPlanner/actions/sdk-generator-versioning
Parsing specification file for changelog and versioning
2 parents c34d3ec + d7d68fd commit d57fb61

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

.github/workflows/api-docs-generator.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ jobs:
5252
uses: actions/download-artifact@v2
5353
with:
5454
name: specification
55+
- name: Parse changelog
56+
id: changelog
57+
run: |
58+
version="$(cat ${{ env.FILE_NAME }} | grep -Po '(?<=version:\s.)[a-zA-Z0-9.]*(?=.$)')"
59+
commit="$(cat ${{ env.FILE_NAME }} | grep -Pzo "(?<=$version:\s>\n)[\s\S]*?[\r\n]{2}" | tr -s ' ')"
60+
commit="${commit//'%'/'%25'}"
61+
commit="${commit//$'\n'/'%0A'}"
62+
commit="${commit//$'\r'/'%0D'}"
63+
echo "::set-output name=version::$version"
64+
echo "::set-output name=commit::$commit"
5565
- name: Setup java
5666
uses: actions/setup-java@v1
5767
with:
@@ -73,7 +83,7 @@ jobs:
7383
if [ -z "$(git status -uno --porcelain)" ]; then
7484
echo "::set-output name=push::false"
7585
else
76-
git commit -m "Generate SDK" -a
86+
git commit -m "${{ steps.changelog.outputs.commit }}" -a
7787
echo "::set-output name=push::true"
7888
fi
7989
shell: bash
@@ -90,10 +100,9 @@ jobs:
90100
env:
91101
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
92102
with:
93-
tag_name: v1.0.${{ github.run_number }}
94-
release_name: Release v1.0.${{ github.run_number }}
95-
body: |
96-
Generated automatically
103+
tag_name: v${{ steps.changelog.outputs.version }}
104+
release_name: Release v${{ steps.changelog.outputs.version }}
105+
body: ${{ steps.changelog.outputs.commit }}
97106
draft: true
98107
prerelease: false
99108
- name: Delete artifacts

0 commit comments

Comments
 (0)