-
Notifications
You must be signed in to change notification settings - Fork 4
154 lines (130 loc) · 4.78 KB
/
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
name: Release to Modrinth and GitHub
on:
push:
tags:
- "v*"
jobs:
build-and-summary-and-github-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build
uses: ./.github/actions/build_artifacts/
- name: Generate summary
uses: ./.github/actions/summary/
- name: Get variables
run: |
raw_file_paths=$(ls ./gathered-artifacts/*)
# adds line breaks
file_paths=${raw_file_paths//$'\n'/,}
echo "file_paths=${file_paths}" >> $GITHUB_ENV
raw_tag_name=${GITHUB_REF#refs/tags/}
# removes the 'v' prefix
tag_name=${raw_tag_name#v}
echo "tag_name=${tag_name}" >> $GITHUB_ENV
changelog=$(cat changelog.md)
echo "changelog<<EOF" >> $GITHUB_ENV
echo "${changelog}" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
# log prints
echo "file_paths: $file_paths"
echo "tag_name: $tag_name"
echo "changelog: $changelog"
# https://github.com/marketplace/actions/gh-release
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GH_TOKEN }}
repository: 70CentsApple/ChatTools
tag_name: "v${{ env.tag_name }}"
name: "v${{ env.tag_name }}"
body: ${{ env.changelog }}
draft: false
prerelease: false
generate_release_notes: true
files: ${{ env.file_paths }}
modrinth-release:
needs:
- build-and-summary-and-github-release
runs-on: ubuntu-latest
strategy:
matrix:
include:
- game_version: "1.16.5"
target_game_versions: "1.16,1.16.1,1.16.2,1.16.3,1.16.4,1.16.5"
formatted_version_name: "1.16.x"
delay: 70
- game_version: "1.17.1"
target_game_versions: "1.17,1.17.1"
formatted_version_name: "1.17.x"
delay: 60
- game_version: "1.18.2"
target_game_versions: "1.18,1.18.1,1.18.2"
formatted_version_name: "1.18.x"
delay: 50
- game_version: "1.19.4"
target_game_versions: "1.19,1.19.1,1.19.2,1.19.3,1.19.4"
formatted_version_name: "1.19.x"
delay: 40
- game_version: "1.20.1"
target_game_versions: "1.20,1.20.1"
formatted_version_name: "1.20(.1)"
delay: 30
- game_version: "1.20.4"
target_game_versions: "1.20.2,1.20.3,1.20.4"
formatted_version_name: "1.20.2(3,4)"
delay: 20
- game_version: "1.20.6"
target_game_versions: "1.20.5,1.20.6"
formatted_version_name: "1.20.5(6)"
delay: 10
- game_version: "1.21.1"
target_game_versions: "1.21,1.21.1"
formatted_version_name: "1.21.x"
delay: 0
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: Artifacts
path: gathered-artifacts
- name: Sleep for ${{ matrix.delay }} seconds
run: |
echo "Sleeping for ${{ matrix.delay }} seconds..."
sleep ${{ matrix.delay }}
- name: Resolve file path
run: |
file_path=$(ls gathered-artifacts/*${{ matrix.game_version }}*.jar)
echo "file_path=${file_path}" >> $GITHUB_ENV
echo "file_path for this version is: $file_path"
- name: Get variables
run: |
raw_tag_name=${GITHUB_REF#refs/tags/}
# removes the 'v' prefix
tag_name=${raw_tag_name#v}
echo "tag_name=${tag_name}" >> $GITHUB_ENV
response=$(curl -s -H "Authorization: token ${{ secrets.GH_TOKEN }}" "https://api.github.com/repos/70CentsApple/ChatTools/releases/latest")
changelog=$(echo "${response}" | jq -r '.body')
echo "changelog<<EOF" >> $GITHUB_ENV
echo "${changelog}" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
# log prints
echo "tag_name: $tag_name"
echo "changelog: $changelog"
# https://github.com/marketplace/actions/upload-to-modrinth
- name: Upload to Modrinth
uses: RubixDev/modrinth-upload@v1
with:
token: ${{ secrets.MODRINTH_TOKEN }}
file_path: ${{ env.file_path }}
name: "v${{ env.tag_name }}+${{ matrix.formatted_version_name }}"
version: ${{ env.tag_name }}
changelog: ${{ env.changelog }}
# requires Cloth Config
relations: "9s6osm5g:required"
game_versions: ${{ matrix.target_game_versions }}
release_type: "release"
loaders: "fabric"
featured: false
project_id: "pbnlOdwp"