Skip to content

Commit 1889717

Browse files
author
khanh.nguyen
committed
Add changelog file and tagging release
1 parent 96e9d9a commit 1889717

File tree

3 files changed

+50
-1
lines changed

3 files changed

+50
-1
lines changed

.github/workflows/gh-release.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Github Release
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
jobs:
8+
create-release:
9+
name: Create Release
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v2
14+
- name: Setup git
15+
run: |
16+
git config user.email "[email protected]"
17+
git config user.name "MessageBird CI"
18+
- name: Prepare description
19+
run: |
20+
csplit -s CHANGELOG.md "/##/" {1}
21+
cat xx01 > CHANGELOG.tmp
22+
- name: Prepare tag
23+
run: |
24+
export TAG=$(head -1 CHANGELOG.tmp | cut -d' ' -f2)
25+
echo "TAG=$TAG" >> $GITHUB_ENV
26+
- name: Create Release
27+
uses: actions/create-release@v1
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
with:
31+
tag_name: ${{ env.TAG }}
32+
release_name: ${{ env.TAG }}
33+
body_path: CHANGELOG.tmp
34+
draft: false
35+
prerelease: false

.github/workflows/release.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,21 @@ jobs:
5050
git config user.name "MessageBird CI"
5151
git fetch
5252
git checkout ${{ github.event.pull_request.head.ref }}
53+
- name: Prepare CHANGELOG
54+
run: |
55+
echo "${{ github.event.pull_request.body }}" | csplit -s - "/##/"
56+
echo "# Changelog
57+
## ${{ env.VERSION }}
58+
" >> CHANGELOG.tmp
59+
grep "^*" xx01 >> CHANGELOG.tmp
60+
grep -v "^# " CHANGELOG.md >> CHANGELOG.tmp
61+
cp CHANGELOG.tmp CHANGELOG.md
5362
- name: Prepare version.rb
5463
run: |
5564
sed -i "s|STRING = '[^']*'|STRING = '${{ env.VERSION }}'|" lib/messagebird/version.rb
5665
- name: Commit changes
5766
run: |
58-
git add lib/messagebird/version.rb
67+
git add CHANGELOG.md lib/messagebird/version.rb
5968
git commit -m "Bump to version ${{ env.VERSION }}"
6069
- name: Push
6170
run: git push

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
## 3.1.0
4+
5+
* [ADDED] Add release and publish GitHub actions

0 commit comments

Comments
 (0)