forked from xfl03/MCCustomSkinLoader
-
Notifications
You must be signed in to change notification settings - Fork 0
209 lines (202 loc) · 7.57 KB
/
common.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
name: Common
on:
workflow_call:
inputs:
type:
required: true
type: string
publish-task:
required: false
type: string
is-snapshot:
required: false
type: boolean
default: true
jobs:
build-common:
name: Build
runs-on: ubuntu-latest
environment: Build
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '8'
cache: 'gradle'
-
name: Build
env:
KEY_PASS: ${{ secrets.KEY_PASS }}
IS_SNAPSHOT: ${{ inputs.is-snapshot }}
run: |
echo Snapshot: $IS_SNAPSHOT
export GIT_COMMIT_DESC=$(git log --format=%B -n 1 $GITHUB_SHA)
./gradlew clean build --stacktrace
-
uses: actions/upload-artifact@v3
name: Publish to Github Artifact
with:
name: CustomSkinLoader-${{ inputs.type }}-${{ github.run_number }}
path: build/libs
Upload:
if: inputs.publish-task
needs: build-common
continue-on-error: true
environment: Build
strategy:
matrix:
website: [CurseForge_Modrinth]
modtype: [Fabric,Forge-Active,Forge-Legacy]
include:
-
website: ObjectStorage
modtype: All
# -
# website: GitHub-Release
# modtype: All
-
website: GitHub-PreRelease
modtype: All
name: ${{ matrix.website }} (${{ matrix.modtype}})
runs-on: ubuntu-latest
steps:
-
name: Checkout Git Repository
uses: actions/checkout@v3
-
uses: actions/download-artifact@v3
name: Download Artifact Zips
with:
path: build
-
name: Preparation Folder
run: |
rsync -avz "build/$(ls build|grep "CustomSkinLoader")/" build/libs/
ls -lh build
-
if: ${{ matrix.modtype != 'All' }}
name: Checking and setting the environment
id: cslenv
run: |
output="$(ls build/libs | grep -v "sources")"
if [[ "${{ matrix.modtype }}" == "Forge"* ]]; then
modloader="Forge"
path=$(echo ${{ matrix.modtype }} | sed "s#-#/#")
else
modloader=${{ matrix.modtype }}
path=${{ matrix.modtype }}
fi
echo "path=$path" >> $GITHUB_OUTPUT
echo "modloader=$modloader" >> $GITHUB_OUTPUT
echo "filename=$(echo "$output"|grep $(echo ${{ matrix.modtype }}|sed "s#-##") )" >> $GITHUB_OUTPUT
echo "version=$(grep "version=" build.properties | grep -v "#" | sed "s/version=//")" >> $GITHUB_OUTPUT
echo "edition=$(echo ${{ matrix.modtype }} | sed "s/-//")" >> $GITHUB_OUTPUT
echo "minecraft_vers<<EOF" >> $GITHUB_OUTPUT
grep "minecraft_full_versions=" "$path"/build.properties | grep -v "#" | sed "s/minecraft_full_versions=//" | sed "s/,/\n/g" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "java_vers<<EOF" >> $GITHUB_OUTPUT
grep "java_full_versions=" "$path"/build.properties | grep -v "#" | sed "s/java_full_versions=//" | sed "s/,/\n/g" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
-
if: startsWith(matrix.website, 'GitHub-')
name: Settings more strings to Environment
id: cslenv-github
run: |
#展开
echo "buildtime=$(TZ=Asia/Shanghai date "+%Y.%m.%d %H:%M")" >> $GITHUB_OUTPUT
echo "pathlist="$(find build/libs -type f|grep -v "sources"|grep -v "json")"" >> $GITHUB_OUTPUT
-
if: ${{ matrix.website == 'GitHub-PreRelease' && startsWith(github.ref, 'refs/heads') }}
name: "[GitHub Pre-Release] Delete"
uses: 8Mi-Tech/delete-release-assets-action@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag: CI-Build
deleteOnlyFromDrafts: false
-
if: ${{ matrix.website == 'GitHub-PreRelease' && startsWith(github.ref, 'refs/heads') }}
name: 【GitHub Pre-Release】 Set CI-Build Text
run: |
cat > build/ci-build.md << 'EOF'
Build Time / 构建时间 : ${{ steps.cslenv-github.outputs.buildtime }}
自动同步分支 ${{ github.ref_name }} 的代码,以保持最新
Synchronize ${{ github.ref_name }} branch code updates, keeping only the latest version
<br>
[如何使用 / How to uses?](https://github.com/xfl03/MCCustomSkinLoader/wiki/How-to-Use)
EOF
-
if: ${{ matrix.website == 'GitHub-PreRelease' && startsWith(github.ref, 'refs/heads') }}
name: "[GitHub Pre-Release] Upload Tag"
uses: richardsimko/[email protected]
with:
tag_name: CI-Build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
if: ${{ matrix.website == 'GitHub-PreRelease' && startsWith(github.ref, 'refs/heads') }}
name: "[GitHub Pre-Release] Publish"
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: CustomSkinLoader CI-Build
tag_name: CI-Build
prerelease: true
body_path: build/ci-build.md
files: build/libs/*
#iles: "${{ steps.cslenv-github.outputs.pathlist }}"
-
if: ${{ matrix.website == 'GitHub-Release' && inputs.type == 'Release' }}
uses: softprops/action-gh-release@v1
name: "[GitHub Release] Publish"
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: CustomSkinLoader ${{ github.ref }}
tag_name: ${{ github.ref }}
#generate_release_notes: true
files: ${{ steps.cslenv-github.outputs.pathlist }}
-
if: ${{ matrix.website == 'ObjectStorage' }}
name: "[ObjectStorage] Publish"
env:
COS_BUCKET: ${{ secrets.COS_BUCKET }}
COS_SECRET_ID: ${{ secrets.COS_SECRET_ID }}
COS_SECRET_KEY: ${{ secrets.COS_SECRET_KEY }}
R2_BASE_URL: ${{ secrets.R2_BASE_URL }}
R2_BUCKET: ${{ secrets.R2_BUCKET }}
R2_SECRET_ID: ${{ secrets.R2_SECRET_ID }}
R2_SECRET_KEY: ${{ secrets.R2_SECRET_KEY }}
IS_SNAPSHOT: ${{ inputs.is-snapshot }}
run: |
export GIT_COMMIT_DESC=$(git log --format=%B -n 1 $GITHUB_SHA)
./gradlew ${{ inputs.publish-task }} --info --stacktrace
# ./gradlew publishGprPublicationToGitHubPackagesRepository
-
if: ${{ matrix.website == 'CurseForge_Modrinth' && inputs.type == 'Release' }}
name: "[CurseForge & Modrinth] Publish"
uses: Kir-Antipov/[email protected]
with:
modrinth-id: idMHQ4n2
modrinth-featured: true
modrinth-unfeature-mode: subset
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
curseforge-id: 286924
curseforge-token: ${{ secrets.CURSEFORGE_API_KEY }}
name: CustomSkinLoader_${{ steps.cslenv.outputs.edition }}_${{ steps.cslenv.outputs.version }}
version: ${{ steps.cslenv.outputs.version }}-${{ steps.cslenv.outputs.edition }}
version-type: release
loaders: ${{ steps.cslenv.outputs.modloader }}
game-versions: |
${{ steps.cslenv.outputs.minecraft_vers }}
game-version-filter: releases
java: |
${{ steps.cslenv.outputs.java_vers }}
retry-attempts: 2
retry-delay: 10000
fail-mode: fail
files: |
build/libs/${{ steps.cslenv.outputs.filename }}