-
Notifications
You must be signed in to change notification settings - Fork 25
86 lines (80 loc) · 2.96 KB
/
publish.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
name: publish
env:
MOD_NAME: Decorative Blocks
CURSEFORGE_ID: 362528
MODRINTH_ID: t6BIRVZn
on:
workflow_dispatch:
jobs:
call-build-workflow:
permissions:
contents: read
uses: "./.github/workflows/build.yml"
publish:
needs: call-build-workflow
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
website: [ modrinth, curseforge ]
loader: [ Forge, Fabric ]
name: ${{ matrix.website }} (${{ matrix.loader }})
steps:
- uses: actions/checkout@v3
- name: Download artifact
uses: actions/download-artifact@v3
continue-on-error: true
with:
name: ${{ env.MOD_NAME }}
- name: Checking and setting the environment
continue-on-error: true
run: |
export loader=${{ matrix.loader }}
export name=$(ls ${loader}/build/libs/ | grep shadow -v | grep sources -v | grep javadoc -v | awk -F.jar '{print $1}')
export mod_name=$(echo $name | awk -F- '{print $1}')
export loader_name=$(echo $name | awk -F- '{print $2}')
export mc_version=$(echo $name | awk -F- '{print $3}')
export mod_version=$(echo $name | awk -F- '{print $4}')
echo "name=$name" >> $GITHUB_ENV
echo "mod_name=$mod_name" >> $GITHUB_ENV
echo "loader_name=$loader_name" >> $GITHUB_ENV
echo "mc_version=$mc_version" >> $GITHUB_ENV
echo "mod_version=$mod_version" >> $GITHUB_ENV
rm ${loader}/build/libs/*shadow.jar
- name: Publish Modrinth Release
uses: Kir-Antipov/[email protected]
if: matrix.website == 'modrinth'
with:
modrinth-id: ${{ env.MODRINTH_ID }}
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
files: |
${{ matrix.loader }}/build/libs/!(*-@(dev|sources|javadoc)).jar
${{ matrix.loader }}/build/libs/*-@(dev|sources|javadocs).jar
java: Java 17
name: >
"["
${{ matrix.loader }} ${{ env.mc_version }}
"] "
v${{ env.mod_version }}
version: ${{ env.mod_version }}+${{ env.loader_name }}
version-type: release
changelog-file: CHANGELOG.*
- name: Publish Curseforge Release
uses: Kir-Antipov/[email protected]
if: matrix.website == 'curseforge'
with:
curseforge-id: ${{ env.CURSEFORGE_ID }}
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
files: |
${{ matrix.loader }}/build/libs/!(*-@(dev|sources|javadoc)).jar
${{ matrix.loader }}/build/libs/*-@(dev|sources|javadocs).jar
java: Java 17
name: >
"["
${{ matrix.loader }} ${{ env.mc_version }}
"] "
v${{ env.mod_version }}
version: ${{ env.mod_version }}+${{ env.loader_name }}
version-type: release
changelog-file: CHANGELOG.*