-
Notifications
You must be signed in to change notification settings - Fork 4
57 lines (54 loc) · 2.33 KB
/
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Create a new release on main automatically based on conventional commit messages
name: "Release"
on:
push:
branches:
- main
jobs:
release:
if: "github.event.head_commit.message != 'chore: storing version and changelog'"
name: Releasing a new version
runs-on: ubuntu-latest
steps:
- name: Set token for protected branch pusher app
id: app
uses: getsentry/action-github-app-token@v2
with:
app_id: ${{ secrets.PROTECTEDBRANCHPUSHER_APP_ID }}
private_key: ${{ secrets.PROTECTEDBRANCHPUSHER_PRIVATE_KEY }}
- uses: actions/checkout@v2
with:
fetch-depth: 0
token: "${{ steps.app.outputs.token }}"
- name: Calculate version
id: calculate_version
uses: mathieudutour/github-tag-action@v6.1
with:
github_token: "${{ steps.app.outputs.token }}"
dry_run: true
default_bump: false
- name: "Write changelog"
run: |
CHANGELOG=""
if [ -e CHANGELOG.md ]
then
CHANGELOG=$(cat CHANGELOG.md)
fi
echo -e "${{steps.calculate_version.outputs.changelog}}\n\n${CHANGELOG}" > CHANGELOG.md
if: steps.calculate_version.outputs.new_version != ''
- name: "Commit"
id: "commit"
uses: EndBug/add-and-commit@v9.1.1
with:
message: 'chore: storing version and changelog'
push: true
if: steps.calculate_version.outputs.new_version != ''
- name: Create Release
uses: ncipollo/release-action@v1.12.0
with:
commit: ${{ steps.commit.outputs.commit_long_sha }}
tag: ${{ steps.calculate_version.outputs.new_tag }}
name: ${{ steps.calculate_version.outputs.new_tag }}
body: ${{ steps.calculate_version.outputs.changelog }}
token: "${{ steps.app.outputs.token }}"
if: steps.calculate_version.outputs.new_version != ''