-
Notifications
You must be signed in to change notification settings - Fork 19
176 lines (167 loc) · 7.1 KB
/
push.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
name: Pre-release Pipeline
concurrency: pre-release-pipeline
on:
push:
branches:
- main
paths-ignore:
- modpack-update-checker/**
- java/**
env:
pack-file: "pack.toml"
name: 'Create: Prepare to Dye'
slug: 'create-prepare-to-dye'
modrinth-url: 'https://modrinth.com/modpack/create-prepare-to-dye'
loader: 'forge'
mc_version: '1.19.2'
jobs:
check_rank:
needs: [tag_and_release]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
limit=100
offset=0
totalItems=1000
while [ $offset -lt $totalItems ]; do
curl --silent "https://api.modrinth.com/v2/search?limit=$limit&offset=$offset&facets=%5B%5B%22project_type%3Amodpack%22%5D%5D" | \
jq '.hits | to_entries[] | "\(.key + $offset): \(.value.title)"' --argjson offset $offset | grep "${{env.name}}" | sed 's/:.*//' | tr -d '"' >> rank
offset=$((offset + limit))
done
old_rank=$(cat README.md | grep -o 'Modrint%20Rank-[0-9]*' | sed 's/Modrint%20Rank-//')
new_rank=$(cat rank)
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: validate JSON and YAML files
uses: GrantBirki/json-yaml-validate@v2.4.0
tag_and_release:
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/github-tag-action@v6.1
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.GH_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.GH_TOKEN }}
prerelease: true
release:
needs: [tag_and_release, tests]
strategy:
matrix:
include:
- platform: modrinth
file_suffix: mrpack
- platform: curseforge
file_suffix: zip
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- 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 args
id: build_args
run: echo 'name=${{ needs.tag_and_release.outputs.new_tag }}-${{ env.slug }} [forge][${{ matrix.platform }}]' >> $GITHUB_OUTPUT
# - name: Detect curseforge jars
# if: matrix.platform == 'curseforge'
# run: packwiz curseforge detect
- name: Get unix time
id: get_time
run: echo "time=$(date +%s%3N)" >> $GITHUB_OUTPUT
- name: Update changelog files
run: |
cd modpack-update-checker
echo $(jq -r '.versions[.versions| length] |= . + {"id":"${{ needs.tag_and_release.outputs.new_tag }}","releasedAt":${{ steps.get_time.outputs.time }}}' meta.json) > meta.json
mkdir versions/${{ needs.tag_and_release.outputs.new_tag }}
echo "${{ needs.tag_and_release.outputs.changelog }}" > versions/${{ needs.tag_and_release.outputs.new_tag }}/changelog.txt
cd ../config
echo $(jq -r '.currentVersion = "${{ needs.tag_and_release.outputs.new_tag }}"' modpack-update-checker/config.json) > modpack-update-checker/config.json
- name: Update discord presense text
run: |
cd kubejs/assets/sdrp/lang
json=$(jq '."sdrp.logo"="Hanging out with Betsy on version ${{ needs.tag_and_release.outputs.new_tag }}"' en_us.json)
echo $json > en_us.json
- name: Move to curseforge folder and take some folders with me
if: matrix.platform == 'curseforge'
run: |
cd curseforge
cp -R ../config ../defaultconfigs ../fancymenu_data ../kubejs ../modpack-update-checker ../discord-mark-blue.png ../discord-mark-white.png .
- name: Build Modpack modrinth
if : matrix.platform == 'modrinth'
run: packwiz ${{ matrix.platform }} export --output "${{ steps.build_args.outputs.name }}.${{ matrix.file_suffix }}"
- name: Build Modpack curseforge
if : matrix.platform == 'curseforge'
run: |
cd curseforge
packwiz ${{ matrix.platform }} export --output "${{ steps.build_args.outputs.name }}.${{ matrix.file_suffix }}"
cp *.zip ../
- name: Upload Modpack file to GitHub Releases
run: |
gh release upload ${{ needs.tag_and_release.outputs.new_tag }} *.${{ matrix.file_suffix }} \
--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/mc-publish@v3.3.0
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: "*.mrpack"
version: ${{ needs.tag_and_release.outputs.new_tag }}
version-type: beta
name: ${{ steps.build_args.outputs.name }}
- name: Update modrinth description to match reademe
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: Pull
if: matrix.platform == 'modrinth'
run: git pull
- name: Commit & Push changes
if: matrix.platform == 'modrinth'
uses: actions-js/push@master
with:
github_token: ${{ secrets.GH_TOKEN }}
- name: Publish to CurseForge
if: matrix.platform == 'curseforge'
uses: Kir-Antipov/mc-publish@v3.3.0
with:
curseforge-id: ${{ vars.CF_ID }}
curseforge-token: ${{ secrets.CF_API_TOKEN }}
loaders: forge
game-versions: 1.19.2
changelog: ${{ needs.tag_and_release.outputs.changelog }}
files: "*.zip"
version: ${{ needs.tag_and_release.outputs.new_tag }}
version-type: release
name: ${{ steps.build_args.outputs.name }}
curseforge-version: ${{ needs.tag_and_release.outputs.new_tag }}