-
Notifications
You must be signed in to change notification settings - Fork 2
34 lines (30 loc) · 1.12 KB
/
auto-release.yml
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
name: Auto Release on 'new-release' commit
on:
push:
branches:
- main
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Check commit message for '#new-release'
run: |
commit_message=$(git log --format=%B -n 1)
if echo "$commit_message" | grep -q '#new-release'; then
if [[ "$commit_message" =~ <new-release:([^>]+)> ]]; then
new_release="${BASH_REMATCH[1]}"
echo "Creating release $new_release"
git config --global user.name 'GitHub Actions Bot'
git config --global user.email '<>'
git tag -a "$new_release" -m "Release $new_release"
git push origin "$new_release"
else
echo "Commit includes '#new-release' but no tag found in <new-release:tag> format. Skipping release."
exit 1
fi
else
echo "Commit does not include '#new-release'. Skipping release."
exit 0
fi