generated from SmushyTaco/Example-Mod
-
-
Notifications
You must be signed in to change notification settings - Fork 1
186 lines (176 loc) · 6.01 KB
/
publish-release.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
name: Publish Staff Mod
on:
push:
tags:
- "*"
jobs:
build:
name: Build Staff Mod
uses: ./.github/workflows/build.yml
with:
build-project: true
build-docs: true
upload-output: true
fast: true
publish:
name: Publish Staff Mod
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download Fabric jars
uses: actions/download-artifact@v3
with:
name: fabric-jars
path: dist/fabric
- name: Download Forge jars
uses: actions/download-artifact@v3
with:
name: forge-jars
path: dist/forge
- name: Fetch release tag
run: git fetch origin $GITHUB_REF:$GITHUB_REF -f
- name: Generate changelog
run: git for-each-ref $GITHUB_REF --format '%(contents)' > CHANGELOG.g.md
- name: Load java version
id: load-java-version
uses: SebRollen/[email protected]
with:
file: gradle/libs.versions.toml
field: versions.java
- name: Load mod version
id: load-mod-version
uses: SebRollen/[email protected]
with:
file: gradle/libs.versions.toml
field: versions.staff-mod
- name: Ensure git tag and mod version match
if: steps.load-mod-version.outputs.value != github.ref_name
run: |
echo "git tag '$GITHUB_REF_NAME' doesn't match mod version '${{ steps.load-mod-version.outputs.value }}'"
exit 1
- name: Publish Fabric mod to Modrinth and CurseForge
uses: Kir-Antipov/[email protected]
with:
modrinth-id: ${{ vars.MODRINTH_ID }}
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
modrinth-featured: false
curseforge-id: ${{ vars.CURSEFORGE_ID }}
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
name: Staff Mod ${{ github.ref_name }} for Fabric
version: ${{ github.ref_name }}+fabric
files: |
dist/fabric/!(*-@(dev|dev-shadow|sources|javadoc)).jar
dist/fabric/*-@(dev|dev-shadow|sources|javadoc).jar
changelog-file: CHANGELOG.g.md
game-version-filter: releases
java: ${{ steps.load-java-version.outputs.value }}
- name: Publish Forge mod to Modrinth and CurseForge
uses: Kir-Antipov/[email protected]
with:
modrinth-id: ${{ vars.MODRINTH_ID }}
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
modrinth-featured: false
curseforge-id: ${{ vars.CURSEFORGE_ID }}
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
name: Staff Mod ${{ github.ref_name }} for Forge
version: ${{ github.ref_name }}+forge
files: |
dist/forge/!(*-@(dev|dev-shadow|sources|javadoc)).jar
dist/forge/*-@(dev|dev-shadow|sources|javadoc).jar
changelog-file: CHANGELOG.g.md
game-version-filter: releases
java: ${{ steps.load-java-version.outputs.value }}
- name: Publish Fabric and Forge mod to GitHub
uses: Kir-Antipov/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
name: Staff Mod ${{ github.ref_name }}
files: |
dist/fabric/!(*-@(dev|sources|javadoc)).jar
dist/fabric/*-@(dev|sources|javadoc).jar
dist/forge/!(*-@(dev|sources|javadoc)).jar
dist/forge/*-@(dev|sources|javadoc).jar
changelog-file: CHANGELOG.g.md
- name: Delete build output
uses: geekyeggo/delete-artifact@v2
with:
name: |
fabric-jars
forge-jars
useGlob: false
failOnError: false
push-docs:
name: Push documentation
runs-on: ubuntu-latest
needs: build
env:
VERSION: ${{ github.ref_name }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: docs
- name: Configure git
run: |
git config user.email "[email protected]"
git config user.name "github-actions[bot]"
- name: Download Kotlin documentation
uses: actions/download-artifact@v3
with:
name: kdoc
path: docs/kdoc/${{ github.ref_name }}
- name: Download Java documentation
uses: actions/download-artifact@v3
with:
name: javadoc
path: docs/javadoc/${{ github.ref_name }}
- name: Update latest documentation folder (Kotlin)
run: |
cd docs/kdoc
unlink latest
ln -s $VERSION latest
- name: Update latest documentation folder (Java)
run: |
cd docs/javadoc
unlink latest
ln -s $VERSION latest
- name: Update links
run: |
sed -i "s|#CI_KDOC_PLACEHOLDER|#CI_KDOC_PLACEHOLDER\n - $VERSION: kdoc/$VERSION|g" mkdocs.yml
sed -i "s|#CI_JAVADOC_PLACEHOLDER|#CI_JAVADOC_PLACEHOLDER\n - $VERSION: javadoc/$VERSION|g" mkdocs.yml
- name: Commit documentation
run: |
git add docs
git commit -a -m "Add documentation for $VERSION"
- name: Push documentation
uses: ad-m/github-push-action@master
with:
branch: docs
- name: Delete documentation artifacts
uses: geekyeggo/delete-artifact@v2
with:
name: |
kdoc
javadoc
useGlob: false
failOnError: false
publish-docs:
name: Publish documentation
runs-on: ubuntu-latest
needs: push-docs
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: docs
- name: Configure git
run: |
git config user.email "[email protected]"
git config user.name "github-actions[bot]"
- name: Publish documentation
uses: mhausenblas/mkdocs-deploy-gh-pages@master
env:
GITHUB_TOKEN: ${{ github.token }}