-
Notifications
You must be signed in to change notification settings - Fork 9
154 lines (131 loc) · 4.04 KB
/
test-build.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: Test Build and Changelog
on:
workflow_dispatch:
jobs:
vars:
name: Get Variables
runs-on: ubuntu-20.04
outputs:
release_type: ${{steps.cf_release_type.outputs.value }}
cf_project: ${{steps.cf_project.outputs.value }}
mod_version: ${{steps.mod_version.outputs.value }}
mod_id: ${{steps.mod_id.outputs.value }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Release Type
id: cf_release_type
uses: christian-draeger/[email protected]
with:
path: './gradle.properties'
property: 'cf_release_type'
- name: Project ID
id: cf_project
uses: christian-draeger/[email protected]
with:
path: './gradle.properties'
property: 'cf_project'
- name: Mod Version
id: mod_version
uses: christian-draeger/[email protected]
with:
path: './gradle.properties'
property: 'mod_version'
- name: Mod ID
id: mod_id
uses: christian-draeger/[email protected]
with:
path: './gradle.properties'
property: 'mod_id'
changelog:
name: Generate Changelog (tags)
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Unshallow
run: git fetch --prune --unshallow
- name: Find Current Tag
id: current
uses: jimschubert/query-tag-action@v1
with:
include: 'v*'
exclude: '*-rc*'
commit-ish: '@'
skip-unshallow: 'true'
- name: Previous Tag
id: last
uses: jimschubert/query-tag-action@v1
with:
include: 'v*'
exclude: ${{steps.current.outputs.tag}}
skip-unshallow: 'true'
- name: Generate changelog
uses: jimschubert/beast-changelog-action@v1
with:
GITHUB_TOKEN: ${{github.token}}
CONFIG_LOCATION: .github/changelog.json
FROM: ${{steps.last.outputs.tag}}
TO: ${{steps.current.outputs.tag}}
OUTPUT: .github/CHANGELOG.md
- name: Read CHANGELOG file
id: getchangelog
run: echo "::set-output name=changelog::$(cat .github/CHANGELOG.md)"
- name: View Changelog
run: cat .github/CHANGELOG.md
- name: Add Artifact
uses: actions/upload-artifact@v2
with:
name: out
path: .github/CHANGELOG.md
jar:
name: Publish JAR
runs-on: ubuntu-20.04
needs: [vars, changelog]
steps:
- name: Download Changelog Results
uses: actions/download-artifact@v2
with:
name: out
path: changelog
- name: Checkout
uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: "17"
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build JAR with Gradle
run: ./gradlew build
# run: ./gradlew publish
env:
GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Output Dir Structure
run: ls -lhR build-out
- name: Add Artifact
uses: actions/upload-artifact@v2
with:
name: libs
path: |
build-out/${{ needs.vars.outputs.mod_id }}-${{ needs.vars.outputs.mod_version }}.jar
build-out/${{ needs.vars.outputs.mod_id }}-${{ needs.vars.outputs.mod_version }}-api.jar
view:
name: View Changelog Output
runs-on: ubuntu-20.04
needs: [changelog]
steps:
- name: Download Build Results
uses: actions/download-artifact@v2
with:
name: out
path: changelog
- run: cat changelog/CHANGELOG.md