1
+ name : Create Github Release
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - main
7
+
8
+ jobs :
9
+ CheckVersion :
10
+ runs-on : ubuntu-latest
11
+ outputs :
12
+ versionChanged : ${{ steps.check_version.outputs.changed }}
13
+ newVersion : ${{ steps.check_version.outputs.version }}
14
+ steps :
15
+ - name : Set up Git repository
16
+ uses : actions/checkout@v3
17
+ with :
18
+ fetch-depth : 0
19
+
20
+ - name : Set up node
21
+ uses : actions/setup-node@v3
22
+ with :
23
+ node-version : 18
24
+
25
+ - name : Check if version has been updated
26
+ id : check_version
27
+ uses : EndBug/version-check@v2
28
+ with :
29
+ diff-search : true
30
+
31
+ - name : Log version change
32
+ if : steps.check_version.outputs.changed == 'true'
33
+ run : ' echo "Version change found in commit ${{ steps.check_version.outputs.commit }}! New version: ${{ steps.check_version.outputs.version }}"'
34
+
35
+ CreateRelease :
36
+ needs : CheckVersion
37
+ if : needs.CheckVersion.outputs.versionChanged == 'true'
38
+ runs-on : ubuntu-latest
39
+
40
+ steps :
41
+ - name : Set up Git repository
42
+ uses : actions/checkout@v3
43
+ with :
44
+ fetch-depth : 0
45
+
46
+ - name : Copy required files to release_files folder
47
+ run : |
48
+ mkdir release_files
49
+ cp ./LICENSE ./release_files/LICENSE
50
+ cp ./README.md ./release_files/README.md
51
+ cp ./config.default.json ./release_files/config.default.json
52
+ cp ./config.schema.json ./release_files/config.schema.json
53
+ cp ./index.js ./release_files/index.js
54
+ cp ./package-lock.json ./release_files/package-lock.json
55
+ cp ./package.json ./release_files/package.json
56
+
57
+ - name : Create .zip of required files
58
+ run : |
59
+ cd release_files
60
+ zip -r ../Game.Pass.API.zip *
61
+
62
+ - name : Create Release notes
63
+ run : |
64
+ echo "## What's Changed
65
+
66
+ " > CHANGELOG.md
67
+ LAST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
68
+ git log --pretty=format:'* %s' $LAST_TAG..HEAD >> CHANGELOG.md
69
+
70
+ - name : Create Release
71
+ uses : softprops/action-gh-release@v1
72
+ env :
73
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
74
+ with :
75
+ tag_name : v${{ needs.CheckVersion.outputs.newVersion }}
76
+ name : v${{ needs.CheckVersion.outputs.newVersion }}
77
+ files : Game.Pass.API.zip
78
+ body_path : CHANGELOG.md
0 commit comments