-
-
Notifications
You must be signed in to change notification settings - Fork 1
72 lines (59 loc) · 2.05 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
## Creates a Github Release:
# If the version in the package.json file changed
# The Release notes will be inferred from the titles of all commits since the last Release
name: Create Github Release
on:
push:
branches:
- main
jobs:
CheckVersion:
runs-on: ubuntu-latest
outputs:
versionChanged: ${{ steps.check_version.outputs.changed }}
newVersion: ${{ steps.check_version.outputs.version }}
steps:
- name: Set up Git repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Check if version has been updated
id: check_version
uses: EndBug/version-check@v2
with:
diff-search: true
- name: Log version change
if: steps.check_version.outputs.changed == 'true'
run: 'echo "Version change found in commit ${{ steps.check_version.outputs.commit }}! New version: ${{ steps.check_version.outputs.version }}"'
CreateRelease:
needs: CheckVersion
if: needs.CheckVersion.outputs.versionChanged == 'true'
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create Release notes
run: |
echo "## What's Changed
" > RELEASE_NOTES.md
sed -n '/<!--Releasenotes start-->/,/<!--Releasenotes end-->/p' CHANGELOG.md >> RELEASE_NOTES.md
echo "
**[Full Changelog](CHANGELOG.md)**" >> RELEASE_NOTES.md
- name: Create Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ needs.CheckVersion.outputs.newVersion }}
name: v${{ needs.CheckVersion.outputs.newVersion }}
body_path: RELEASE_NOTES.md
RunDeployScript:
needs: CheckVersion
if: needs.CheckVersion.outputs.versionChanged == 'true'
uses: ./.github/workflows/deploy.yml