1+ name : Tagged Commit Release
2+
3+ on :
4+ push :
5+ tags : v*
6+ workflow_dispatch :
7+
8+ jobs :
9+ vars :
10+ name : Get Variables
11+ runs-on : ubuntu-latest
12+ outputs :
13+ release_type : ${{steps.cf_release_type.outputs.value }}
14+ cf_project : ${{steps.cf_project.outputs.value }}
15+ mod_version : ${{steps.mod_version.outputs.value }}
16+ steps :
17+ - name : Checkout
18+ uses : actions/checkout@v2
19+
20+ - name : Release Type
21+ id : cf_release_type
22+ uses :
christian-draeger/[email protected] 23+ with :
24+ path : ' ./gradle.properties'
25+ property : ' cf_release_type'
26+
27+ - name : Project ID
28+ id : cf_project
29+ uses :
christian-draeger/[email protected] 30+ with :
31+ path : ' ./gradle.properties'
32+ property : ' cf_project'
33+
34+ - name : Mod Version
35+ id : mod_version
36+ uses :
christian-draeger/[email protected] 37+ with :
38+ path : ' ./gradle.properties'
39+ property : ' mod_version'
40+
41+ changelog :
42+ name : Generate Changelog (tags)
43+ runs-on : ubuntu-latest
44+ steps :
45+ - name : Checkout
46+ uses : actions/checkout@v2
47+
48+ - name : Unshallow
49+ run : git fetch --prune --unshallow
50+
51+ - name : Find Current Tag
52+ id : current
53+ uses : jimschubert/query-tag-action@v1
54+ with :
55+ include : ' v*'
56+ exclude : ' *-rc*'
57+ commit-ish : ' @'
58+ skip-unshallow : ' true'
59+
60+ - name : Previous Tag
61+ id : last
62+ uses : jimschubert/query-tag-action@v1
63+ with :
64+ include : ' v*'
65+ exclude : ${{steps.current.outputs.tag}}
66+ skip-unshallow : ' true'
67+
68+ - name : Generate changelog
69+ uses : jimschubert/beast-changelog-action@v1
70+ with :
71+ GITHUB_TOKEN : ${{github.token}}
72+ CONFIG_LOCATION : .github/changelog.json
73+ FROM : ${{steps.last.outputs.tag}}
74+ TO : ${{steps.current.outputs.tag}}
75+ OUTPUT : .github/CHANGELOG.md
76+
77+ - name : Read CHANGELOG file
78+ id : getchangelog
79+ run : echo "::set-output name=changelog::$(cat .github/CHANGELOG.md)"
80+
81+ - name : View Changelog
82+ run : cat .github/CHANGELOG.md
83+
84+ - name : Add Artifact
85+ uses : actions/upload-artifact@v2
86+ with :
87+ name : out
88+ path : .github/CHANGELOG.md
89+
90+ jar :
91+ name : Publish JAR
92+ runs-on : ubuntu-latest
93+ needs : [vars, changelog]
94+ steps :
95+ - name : Download Changelog Results
96+ uses : actions/download-artifact@v2
97+ with :
98+ name : out
99+ path : changelog
100+
101+ - name : Checkout
102+ uses : actions/checkout@v2
103+
104+ - name : Set up JDK 1.8
105+ uses : actions/setup-java@v1
106+ with :
107+ java-version : 1.8
108+
109+ - name : Cache Gradle packages
110+ uses : actions/cache@v2
111+ with :
112+ path : ~/.gradle/caches
113+ key : ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
114+ restore-keys : ${{ runner.os }}-gradle
115+
116+ - name : Grant execute permission for gradlew
117+ run : chmod +x gradlew
118+
119+ - name : Build JAR with Gradle
120+ run : ./gradlew build
121+ env :
122+ GITHUB_ACTOR : ${{ secrets.GITHUB_ACTOR }}
123+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
124+
125+ - name : Add Artifact
126+ uses : actions/upload-artifact@v2
127+ with :
128+ name : libs
129+ path : build/libs/**${{ needs.vars.outputs.mod_version }}**.jar
130+
131+ view :
132+ name : View Changelog Output
133+ runs-on : ubuntu-latest
134+ needs : [changelog]
135+ steps :
136+ - name : Download Build Results
137+ uses : actions/download-artifact@v2
138+ with :
139+ name : out
140+ path : changelog
141+ - run : cat changelog/CHANGELOG.md
142+
143+ release :
144+ name : Make GitHub Release
145+ runs-on : ubuntu-latest
146+ needs : [changelog, vars, jar]
147+ steps :
148+ - name : Download Build Results
149+ uses : actions/download-artifact@v2
150+ with :
151+ name : libs
152+ path : buildfiles
153+ - name : Download Changelog Results
154+ uses : actions/download-artifact@v2
155+ with :
156+ name : out
157+ path : changelog
158+
159+ - name : Load Changelog File
160+ id : changelog
161+ run : echo ::set-output name=changelog::$(cat changelog/CHANGELOG.md)
162+
163+ - name : Create GitHub Release
164+ uses : " marvinpinto/action-automatic-releases@latest"
165+ with :
166+ title : " Release ${{ github.event.release.tag_name }}"
167+ repo_token : " ${{ secrets.GITHUB_TOKEN }}"
168+ prerelease : false
169+ files : |
170+ changelog/CHANGELOG.md
171+ buildfiles/**${{ needs.vars.outputs.mod_version }}**.jar
172+
173+ - name : Create CurseForge Release
174+ uses : itsmeow/curseforge-upload@master
175+ with :
176+ token : ${{ secrets.CF_API_TOKEN }}
177+ project_id : ${{ needs.vars.outputs.cf_project }}
178+ game_endpoint : minecraft
179+ file_path : buildfiles/**${{ needs.vars.outputs.mod_version }}**.jar
180+ changelog : ${{ steps.changelog.outputs.changelog }}
181+ changelog_type : markdown
182+ game_versions : java:Java 8,Forge
183+ release_type : ${{ needs.vars.outputs.release_type }}
0 commit comments