-
Notifications
You must be signed in to change notification settings - Fork 2
196 lines (194 loc) · 7.28 KB
/
push.yaml
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
name: Push Pipeline
concurrency: Push-pipeline
on:
push:
branches:
- main
env:
pack-file: "pack.toml"
name: "Prepare to Dye Plus"
slug: "ptdye-plus"
loader: "forge"
mc_version: "1.19.2"
target_modpack_repo: "game-design-driven/Create-Prepare-to-Dye"
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: validate JSON and YAML files
uses: GrantBirki/[email protected]
tag_and_release:
permissions:
contents: write
pull-requests: write
actions: write
deployments: write
runs-on: ubuntu-latest
outputs:
new_tag: ${{ steps.tag_version.outputs.new_tag }}
changelog: ${{ steps.tag_version.outputs.changelog }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
tag_prefix: ""
custom_release_rules:
"dev:patch:Developer experience improvments and changes,tweak:patch:Minor tweaks,feat:minor:Features,fix:patch:Fixes,revert:patch:Reverted Changes,docs:patch:Documentation and Localization,test:patch:Tests and testing related changes,mods:patch:Modlist related changes,ci:patch:Continuous Integration"
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
token: ${{ secrets.GITHUB_TOKEN }}
update_mod_version_files:
needs: [tag_and_release, tests]
name: update mod version files
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run update script
run: |
echo Update version files to ${{ needs.tag_and_release.outputs.new_tag }}
chmod +x ./update_version.sh
./update_version.sh ${{ needs.tag_and_release.outputs.new_tag }}
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: update version to ${{ needs.tag_and_release.outputs.new_tag }}
branch: main
build_and_release_on_modrinth_and_curseforge:
needs: [update_mod_version_files, tag_and_release, tests]
name: Build and release ${{ matrix.platform }}
strategy:
matrix:
include:
- platform: modrinth
- platform: curseforge
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: oracle
java-version: 17
- name: Update code
run: |
git pull origin main
- name: Gradle Build Action
uses: gradle/[email protected]
with:
gradle-version: 7.5
- name: Build args
id: build_args
run:
echo 'name=ptdyeplus-${{ needs.tag_and_release.outputs.new_tag }}+${{env.loader}}-1.19.2' >> $GITHUB_OUTPUT
- name: debug
run: |
echo $JAVA_HOME
- name: build
run: |
gradle wrapper
./gradlew jar
ls build/libs
- name: Cache Gradle dependencies for forge
uses: actions/[email protected]
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-forge-${{ env.mc_version }}-${{ env.loader }}
- name: Upload to GitHub Releases
if: matrix.platform == 'modrinth'
run: |
gh release upload ${{ needs.tag_and_release.outputs.new_tag }} build/libs/*.jar \
--repo ${{ github.repository_owner }}/${{ github.event.repository.name }} \
--clobber
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Publish to Modrinth
if: matrix.platform == 'modrinth'
uses: Kir-Antipov/[email protected]
with:
modrinth-id: ${{ vars.MODRINTH_ID }}
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
loaders: ${{ env.loader}}
game-versions: ${{ env.mc_version}}
changelog: ${{ needs.tag_and_release.outputs.changelog }}
files: "build/libs/*.jar"
version: ${{ needs.tag_and_release.outputs.new_tag }}
version-type: beta
name: ${{ steps.build_args.outputs.name }}
- name: Update modrinth description to match readme
if: matrix.platform == 'modrinth'
run: |
curl -X PATCH \
-H "Authorization: ${{ secrets.MODRINTH_TOKEN }}" \
-H "Content-Type: application/json" \
-d "$(cat README.md | jq -R -s '{body: .}')" \
https://api.modrinth.com/v2/project/${{ vars.MODRINTH_ID }}
- name: Publish to CurseForge
if: matrix.platform == 'curseforge'
uses: Kir-Antipov/[email protected]
with:
curseforge-id: ${{ vars.CF_ID }}
curseforge-token: ${{ secrets.CF_API_TOKEN }}
loaders: ${{ env.loader}}
game-versions: ${{ env.mc_version}}
changelog: ${{ needs.tag_and_release.outputs.changelog }}
files: "build/libs/*.jar"
version: ${{ needs.tag_and_release.outputs.new_tag }}
version-type: release
name: ${{ steps.build_args.outputs.name }}
make_pr_for_modpack:
needs: [build_and_release_on_modrinth_and_curseforge, tag_and_release]
name: make pr for modpack
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
repository: ${{ env.target_modpack_repo }}
ref: main
- name: Install packwiz
uses: supplypike/setup-bin@v3
with:
uri: "https://nightly.link/packwiz/packwiz/workflows/go/main/Linux%2064-bit%20x86.zip"
name: "packwiz"
version: "linux"
- name: Build Modpack modrinth
run:
packwiz update ${{ env.slug }}
- name: Wait for curseforge
run: |
echo Waiting 15 minutes for curseforge to approve the uploaded jar
- name: Build Modpack curseforge
run: |
sleep 900
cd curseforge
packwiz update ${{ env.slug }}
- name: Commit changes
run: |
git config --local user.email ${{ github.actor }}@users.noreply.github.com
git config --local user.name ${{ github.actor }}
git commit -a -m "mods: update ${{ env.name }} to ${{ needs.tag_and_release.outputs.new_tag }}"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6-rc
with:
token: ${{ secrets.GH_TOKEN }}
commit-message: "mods: update ${{ env.name }} to ${{ needs.tag_and_release.outputs.new_tag }}"
title: "Updating ${{ env.name }} to ${{ needs.tag_and_release.outputs.new_tag }}"
body: "Changelog: ${{ needs.tag_and_release.outputs.changelog }}"
add-paths: |
"${{ env.pack-file }}"
"mods/*.toml"
"curseforge/${{ env.pack-file }}"
"curseforge/mods/*.toml"
committer: Betsy <${{ github.actor }}@users.noreply.github.com>
push-to-fork: jasperalani/Create-Prepare-to-Dye