Skip to content

Commit 5951e77

Browse files
committed
Separate create-release from publish workflow
1 parent bb1dc7a commit 5951e77

File tree

2 files changed

+70
-28
lines changed

2 files changed

+70
-28
lines changed

.github/workflows/create-release.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: create-release
2+
run-name: Create Release
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
comment:
8+
description: 'Release description'
9+
default: 'New release'
10+
required: false
11+
type: string
12+
13+
permissions:
14+
contents: write
15+
16+
jobs:
17+
init:
18+
name: Init
19+
runs-on: ubuntu-latest
20+
outputs:
21+
version: ${{ steps.set-app-version.outputs.version }}
22+
steps:
23+
- name: Checkout Repository
24+
uses: actions/checkout@v3
25+
- name: Set App Version
26+
id: set-app-version
27+
run: |
28+
appVersion=$(grep -e '.*' src/main/askai/.version)
29+
echo "version=$(echo $appVersion)" >> $GITHUB_OUTPUT
30+
31+
create-release:
32+
needs: init
33+
name: Create Release
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Checkout Repository
37+
uses: actions/checkout@v3
38+
- name: Git Tag Version
39+
uses: yorevs/hspylib/.github/actions/tag-version@master
40+
with:
41+
tag-name: "v${{ needs.init.outputs.version }}"
42+
github-token: ${{ secrets.GITHUB_TOKEN }}
43+
- name: Create Changelog
44+
id: change-log
45+
uses: yorevs/hspylib/.github/actions/changelog@master
46+
with:
47+
tag-name: "v${{ needs.init.outputs.version }}"
48+
- name: Create Release
49+
uses: actions/create-release@v1
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
with:
53+
tag_name: "v${{ needs.init.outputs.version }}"
54+
release_name: "${{ vars.APP_NAME }}-v${{ needs.init.outputs.version }}-r${{ github.run_number }}"
55+
body: |
56+
${{ steps.change-log.outputs.changelog }}
57+
draft: false
58+
prerelease: false

.github/workflows/publish.yml

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,20 @@ on:
1414
default: 'Push for new revision'
1515
required: false
1616
type: string
17-
release_type:
18-
description: 'Release type: Major/Minor/Patch'
17+
revision_type:
18+
description: 'Revision type: Major/Minor/Patch'
1919
type: choice
2020
required: true
2121
default: 'patch'
2222
options:
2323
- 'patch'
2424
- 'minor'
2525
- 'major'
26+
create_release:
27+
description: 'Create a new GitHub release?'
28+
type: boolean
29+
required: false
30+
default: false
2631

2732
permissions:
2833
contents: write
@@ -51,11 +56,11 @@ jobs:
5156
with:
5257
python-version: ${{ vars.PYTHON_VERSION }}
5358
- name: Install Python tools
54-
run: gradle installBuildTools ${gradle_debug_params}
59+
run: gradle installBuildTools ${{ gradle_debug_params }}
5560
- name: Publish
5661
id: publish-it
5762
run: |
58-
bumpver update "--${{ inputs.release_type }}"
63+
bumpver update "--${{ inputs.revision_type }}"
5964
version="$(awk '/./{line=$0} END{print line}' .version)"
6065
echo "version=$( echo "$version" )" >> $GITHUB_OUTPUT
6166
git config --global user.name "$(git log -n 1 --pretty=format:%an)"
@@ -65,30 +70,9 @@ jobs:
6570
git pull --rebase -Xtheirs && git push --atomic origin HEAD
6671
6772
create-release:
68-
needs: publish
69-
name: Create Release
7073
runs-on: ubuntu-latest
7174
steps:
72-
- name: Checkout Repository
73-
uses: actions/checkout@v3
74-
- name: Git Tag Version
75-
uses: yorevs/hspylib/.github/actions/tag-version@master
76-
with:
77-
tag-name: "v${{ needs.publish.outputs.version }}"
78-
github-token: ${{ secrets.GITHUB_TOKEN }}
79-
- name: Create Changelog
80-
id: change-log
81-
uses: yorevs/hspylib/.github/actions/changelog@master
75+
- uses: ./.github/workflows/create-release.yml
8276
with:
83-
tag-name: "v${{ needs.publish.outputs.version }}"
84-
- name: Create Release
85-
uses: actions/create-release@v1
86-
env:
87-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88-
with:
89-
tag_name: "v${{ needs.publish.outputs.version }}"
90-
release_name: "${{ vars.APP_NAME }}-v${{ needs.publish.outputs.version }}-r${{ github.run_number }}"
91-
body: |
92-
${{ steps.change-log.outputs.changelog }}
93-
draft: false
94-
prerelease: false
77+
comment: ${{ inputs.comment }}
78+

0 commit comments

Comments
 (0)