Skip to content

Commit b2cc138

Browse files
authored
Update release-drafter.yml
1 parent 2fb2f3c commit b2cc138

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

.github/workflows/release-drafter.yml

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,43 @@ name: Release Drafter
22

33
on:
44
push:
5-
# branches to consider in the event; optional, defaults to all
65
branches:
76
- master
87

98
jobs:
109
update_release_draft:
1110
runs-on: ubuntu-latest
11+
name: Release Drafter
1212
steps:
13-
- uses: release-drafter/release-drafter@v5
13+
- name: Checkout the repository
14+
uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Find Next Version
19+
id: version
20+
run: |
21+
declare -i newpost
22+
latest=$(git describe --tags $(git rev-list --tags --max-count=1))
23+
latestpre=$(echo "$latest" | awk '{split($0,a,"."); print a[1] "." a[2]}')
24+
datepre=$(date --utc '+%Y.%m')
25+
26+
27+
if [[ "$latestpre" == "$datepre" ]]; then
28+
latestpost=$(echo "$latest" | awk '{split($0,a,"."); print a[3]}')
29+
newpost=$latestpost+1
30+
else
31+
newpost=0
32+
fi
33+
34+
echo Current version: $latest
35+
echo New target version: $datepre.$newpost
36+
echo "::set-output name=version::$datepre.$newpost"
37+
38+
- name: Run Release Drafter
39+
uses: release-drafter/release-drafter@v5
40+
with:
41+
tag: ${{ steps.version.outputs.version }}
42+
name: ${{ steps.version.outputs.version }}
1443
env:
1544
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)