1+ # Creates releases on GH Packages based on a version tag
2+ name : Manual Tagged Github Packages Release
3+
4+ on :
5+ workflow_dispatch :
6+
7+ jobs :
8+ vars :
9+ name : Get Variables
10+ runs-on : ubuntu-20.04
11+ outputs :
12+ release_type : ${{steps.cf_release_type.outputs.value }}
13+ cf_project : ${{steps.cf_project.outputs.value }}
14+ mod_version : ${{steps.mod_version.outputs.value }}
15+ mod_id : ${{steps.mod_id.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+ - name : Mod ID
42+ id : mod_id
43+ uses :
christian-draeger/[email protected] 44+ with :
45+ path : ' ./gradle.properties'
46+ property : ' mod_id'
47+
48+ changelog :
49+ name : Generate Changelog (tags)
50+ runs-on : ubuntu-20.04
51+ steps :
52+ - name : Checkout
53+ uses : actions/checkout@v2
54+
55+ - name : Unshallow
56+ run : git fetch --prune --unshallow
57+
58+ - name : Find Current Tag
59+ id : current
60+ uses : jimschubert/query-tag-action@v1
61+ with :
62+ include : ' v*'
63+ exclude : ' *-rc*'
64+ commit-ish : ' @'
65+ skip-unshallow : ' true'
66+
67+ - name : Previous Tag
68+ id : last
69+ uses : jimschubert/query-tag-action@v1
70+ with :
71+ include : ' v*'
72+ exclude : ${{steps.current.outputs.tag}}
73+ skip-unshallow : ' true'
74+
75+ - name : Generate changelog
76+ uses : jimschubert/beast-changelog-action@v1
77+ with :
78+ GITHUB_TOKEN : ${{github.token}}
79+ CONFIG_LOCATION : .github/changelog.json
80+ FROM : ${{steps.last.outputs.tag}}
81+ TO : ${{steps.current.outputs.tag}}
82+ OUTPUT : .github/CHANGELOG.md
83+
84+ - name : Read CHANGELOG file
85+ id : getchangelog
86+ run : echo "::set-output name=changelog::$(cat .github/CHANGELOG.md)"
87+
88+ - name : View Changelog
89+ run : cat .github/CHANGELOG.md
90+
91+ - name : Add Artifact
92+ uses : actions/upload-artifact@v2
93+ with :
94+ name : out
95+ path : .github/CHANGELOG.md
96+
97+ jar :
98+ name : Publish JAR
99+ runs-on : ubuntu-20.04
100+ needs : [vars, changelog]
101+ steps :
102+ - name : Download Changelog Results
103+ uses : actions/download-artifact@v2
104+ with :
105+ name : out
106+ path : changelog
107+
108+ - name : Checkout
109+ uses : actions/checkout@v2
110+
111+ - name : Set up JDK 1.8
112+ uses : actions/setup-java@v1
113+ with :
114+ java-version : " 8.0.282"
115+
116+ - name : Cache Gradle packages
117+ uses : actions/cache@v2
118+ with :
119+ path : |
120+ ~/.gradle/caches
121+ ~/.gradle/wrapper
122+ key : ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
123+ restore-keys : ${{ runner.os }}-gradle-
124+
125+ - name : Grant execute permission for gradlew
126+ run : chmod +x gradlew
127+
128+ - name : Build JAR with Gradle
129+ run : ./gradlew build
130+ env :
131+ GITHUB_ACTOR : ${{ secrets.GITHUB_ACTOR }}
132+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
133+
134+ - name : Add Artifact
135+ uses : actions/upload-artifact@v2
136+ with :
137+ name : libs
138+ path : |
139+ build-out/${{ needs.vars.outputs.mod_id }}-${{ needs.vars.outputs.mod_version }}.jar
140+ build-out/${{ needs.vars.outputs.mod_id }}-${{ needs.vars.outputs.mod_version }}-api.jar
141+
142+ view :
143+ name : View Changelog Output
144+ runs-on : ubuntu-20.04
145+ needs : [changelog]
146+ steps :
147+ - name : Download Build Results
148+ uses : actions/download-artifact@v2
149+ with :
150+ name : out
151+ path : changelog
152+ - run : cat changelog/CHANGELOG.md
153+
154+ publishMaven :
155+ name : Maven Release (GH Packages)
156+ runs-on : ubuntu-20.04
157+ needs : [changelog, vars, jar]
158+ steps :
159+ - name : Publish package
160+ run : ./gradlew publish
161+ env :
162+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments