@@ -28,134 +28,134 @@ jobs:
2828 with :
2929 release : true
3030
31- release :
32- needs :
33- - matrix_prep
34- - build
35- runs-on : ubuntu-latest
36-
37- permissions :
38- contents : write
39-
40- strategy :
41- matrix : ${{ fromJson(needs.matrix_prep.outputs.matrix) }}
42-
43- steps :
44- - uses : actions/checkout@v3
45-
46- - name : Display context
47- run : |
48- echo ref_name = ${{ github.ref_name }}
49- echo target_release_tag = ${{ github.event.inputs.target_release_tag }}
50-
51- - name : Download build artifacts
52- uses : actions/download-artifact@v3
53- with :
54- name : build-artifacts
55- path : build-artifacts
56-
57- - name : Get github release information
58- if : ${{ github.event_name == 'workflow_dispatch' }}
59- id : get_release
60- uses : cardinalby/git-get-release-action@1.2.4
61- env :
62- GITHUB_TOKEN : ${{ github.token }}
63- with :
64- tag : ${{ github.event.inputs.target_release_tag }}
65-
66- - name : Generate publish related information
67- id : release_info
68- run : |
69- if [ $GITHUB_EVENT_NAME == 'release' ]
70- then
71- echo "tag_name=" >> $GITHUB_OUTPUT # leave an empty value here so softprops/action-gh-release will use the default value
72- elif [ $GITHUB_EVENT_NAME == 'workflow_dispatch' ]
73- then
74- echo "tag_name=${{ github.event.inputs.target_release_tag }}" >> $GITHUB_OUTPUT
75- else
76- echo Unknown github event name $GITHUB_EVENT_NAME
77- exit 1
78- fi
79-
80- - name : Read common properties
81- id : properties_g
82- uses : christian-draeger/read-properties@1.1.1
83- with :
84- path : gradle.properties
85- properties : ' archives_name mod_version minecraft_version minecraft_supported_versions'
86-
87- - name : Fix game version
88- id : game_versions
89- run : |
90- # Fixed \n in game_versions isn't parsed by christian-draeger/read-properties as a line separator
91- echo 'value<<EOF' >> $GITHUB_OUTPUT
92- echo -e "${{ steps.properties_v.outputs.minecraft_support_version }}" >> $GITHUB_OUTPUT
93- echo 'EOF' >> $GITHUB_OUTPUT
94-
95- - name : Prepare file information
96- id : file_info
97- run : |
98- shopt -s extglob
99- FILE_PATHS=$(ls ${{ format('build-artifacts/{0}/build/libs/!(*-@(dev|sources|shadow)).jar', matrix.subproject) }})
100- if (( ${#FILE_PATHS[@]} != 1 )); then
101- echo "Error: Found ${#FILE_PATHS[@]} files, expected exactly 1"
102- exit 1
103- else
104- FILE_PATH=${FILE_PATHS[0]}
105- fi
31+ release :
32+ needs :
33+ - matrix_prep
34+ - build
35+ runs-on : ubuntu-latest
36+
37+ permissions :
38+ contents : write
39+
40+ strategy :
41+ matrix : ${{ fromJson(needs.matrix_prep.outputs.matrix) }}
42+
43+ steps :
44+ - uses : actions/checkout@v3
45+
46+ - name : Display context
47+ run : |
48+ echo ref_name = ${{ github.ref_name }}
49+ echo target_release_tag = ${{ github.event.inputs.target_release_tag }}
50+
51+ - name : Download build artifacts
52+ uses : actions/download-artifact@v3
53+ with :
54+ name : build-artifacts
55+ path : build-artifacts
56+
57+ - name : Get github release information
58+ if : ${{ github.event_name == 'workflow_dispatch' }}
59+ id : get_release
60+ uses : cardinalby/git-get-release-action@1.2.4
61+ env :
62+ GITHUB_TOKEN : ${{ github.token }}
63+ with :
64+ tag : ${{ github.event.inputs.target_release_tag }}
65+
66+ - name : Generate publish related information
67+ id : release_info
68+ run : |
69+ if [ $GITHUB_EVENT_NAME == 'release' ]
70+ then
71+ echo "tag_name=" >> $GITHUB_OUTPUT # leave an empty value here so softprops/action-gh-release will use the default value
72+ elif [ $GITHUB_EVENT_NAME == 'workflow_dispatch' ]
73+ then
74+ echo "tag_name=${{ github.event.inputs.target_release_tag }}" >> $GITHUB_OUTPUT
75+ else
76+ echo Unknown github event name $GITHUB_EVENT_NAME
77+ exit 1
78+ fi
79+
80+ - name : Read common properties
81+ id : properties_g
82+ uses : christian-draeger/read-properties@1.1.1
83+ with :
84+ path : gradle.properties
85+ properties : ' archives_name mod_version minecraft_version minecraft_supported_versions'
86+
87+ - name : Fix game version
88+ id : game_versions
89+ run : |
90+ # Fixed \n in game_versions isn't parsed by christian-draeger/read-properties as a line separator
91+ echo 'value<<EOF' >> $GITHUB_OUTPUT
92+ echo -e "${{ steps.properties_v.outputs.minecraft_support_version }}" >> $GITHUB_OUTPUT
93+ echo 'EOF' >> $GITHUB_OUTPUT
94+
95+ - name : Prepare file information
96+ id : file_info
97+ run : |
98+ shopt -s extglob
99+ FILE_PATHS=$(ls ${{ format('build-artifacts/{0}/build/libs/!(*-@(dev|sources|shadow)).jar', matrix.subproject) }})
100+ if (( ${#FILE_PATHS[@]} != 1 )); then
101+ echo "Error: Found ${#FILE_PATHS[@]} files, expected exactly 1"
102+ exit 1
103+ else
104+ FILE_PATH=${FILE_PATHS[0]}
105+ fi
106+
107+ FILE_NAME=$(basename $FILE_PATH)
108+ FILE_HASH=$(sha256sum $FILE_PATH | awk '{ print $1 }')
109+ echo "path=$FILE_PATH" >> $GITHUB_OUTPUT
110+ echo "name=$FILE_NAME" >> $GITHUB_OUTPUT
111+ echo "hash=$FILE_HASH" >> $GITHUB_OUTPUT
112+ cat $GITHUB_OUTPUT
113+
114+ - name : Prepare changelog
115+ uses : actions/github-script@v6
116+ id : changelog
117+ with :
118+ script : return process.env.CHANGELOG
119+ result-encoding : string
120+ env :
121+ CHANGELOG : |-
122+ ${{ format('{0}{1}', github.event.release.body, steps.get_release.outputs.body) }}
123+
124+ -------
125+
126+ Build Information
106127
107- FILE_NAME=$(basename $FILE_PATH)
108- FILE_HASH=$(sha256sum $FILE_PATH | awk '{ print $1 }')
109- echo "path=$FILE_PATH" >> $GITHUB_OUTPUT
110- echo "name=$FILE_NAME" >> $GITHUB_OUTPUT
111- echo "hash=$FILE_HASH" >> $GITHUB_OUTPUT
112- cat $GITHUB_OUTPUT
113-
114- - name : Prepare changelog
115- uses : actions/github-script@v6
116- id : changelog
117- with :
118- script : return process.env.CHANGELOG
119- result-encoding : string
120- env :
121- CHANGELOG : |-
122- ${{ format('{0}{1}', github.event.release.body, steps.get_release.outputs.body) }}
123-
124- -------
125-
126- Build Information
127-
128- - File name: `${{ steps.file_info.outputs.name }}`
129- - SHA-256: `${{ steps.file_info.outputs.hash }}`
130- - Built from: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
131-
132- - name : Publish Minecraft Mods
133- uses : Kir-Antipov/mc-publish@v3.3
134- with :
135- modrinth-id : DgWBIBY5 # https://modrinth.com/mod/quickbackupmulti
136- modrinth-token : ${{ secrets.MODRINTH_API_TOKEN }}
137-
138- curseforge-id : 951047 # https://www.curseforge.com/minecraft/mc-mods/quickbackupmulti
139- curseforge-token : ${{ secrets.CURSEFORGE_TOKEN }}
140-
141- github-tag : ${{ steps.release_info.outputs.tag_name }}
142- github-token : ${{ secrets.GITHUB_TOKEN }}
143-
144- files : ${{ steps.file_info.outputs.path }}
145-
146- name : ${{ format('{0} v{1} for mc{2}', steps.properties_g.outputs.archives_name, steps.properties_g.outputs.mod_version, steps.properties_v.outputs.minecraft_version) }}
147- version : ${{ format('mc{0}-v{1}', steps.properties_v.outputs.minecraft_version, steps.properties_g.outputs.mod_version) }}
148- version-type : release
149-
150- loaders : |
151- fabric
152- neoforge
153- game-versions : ${{ steps.game_versions.outputs.value }}
154- game-version-filter : any
155-
156- github-changelog : ${{ format('{0}{1}', github.event.release.body, steps.get_release.outputs.body) }}
157- modrinth-changelog : ${{ steps.changelog.outputs.result }}
158- curseforge-changelog : ${{ steps.changelog.outputs.result }}
159-
160- retry-attempts : 3
161- retry-delay : 10000
128+ - File name: `${{ steps.file_info.outputs.name }}`
129+ - SHA-256: `${{ steps.file_info.outputs.hash }}`
130+ - Built from: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
131+
132+ - name : Publish Minecraft Mods
133+ uses : Kir-Antipov/mc-publish@v3.3
134+ with :
135+ modrinth-id : DgWBIBY5 # https://modrinth.com/mod/quickbackupmulti
136+ modrinth-token : ${{ secrets.MODRINTH_API_TOKEN }}
137+
138+ curseforge-id : 951047 # https://www.curseforge.com/minecraft/mc-mods/quickbackupmulti
139+ curseforge-token : ${{ secrets.CURSEFORGE_TOKEN }}
140+
141+ github-tag : ${{ steps.release_info.outputs.tag_name }}
142+ github-token : ${{ secrets.GITHUB_TOKEN }}
143+
144+ files : ${{ steps.file_info.outputs.path }}
145+
146+ name : ${{ format('{0} v{1} for mc{2}', steps.properties_g.outputs.archives_name, steps.properties_g.outputs.mod_version, steps.properties_v.outputs.minecraft_version) }}
147+ version : ${{ format('mc{0}-v{1}', steps.properties_v.outputs.minecraft_version, steps.properties_g.outputs.mod_version) }}
148+ version-type : release
149+
150+ loaders : |
151+ fabric
152+ neoforge
153+ game-versions : ${{ steps.game_versions.outputs.value }}
154+ game-version-filter : any
155+
156+ github-changelog : ${{ format('{0}{1}', github.event.release.body, steps.get_release.outputs.body) }}
157+ modrinth-changelog : ${{ steps.changelog.outputs.result }}
158+ curseforge-changelog : ${{ steps.changelog.outputs.result }}
159+
160+ retry-attempts : 3
161+ retry-delay : 10000
0 commit comments