forked from Hendrix-Shen/MagicLib
-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (130 loc) · 4.7 KB
/
prepare_action_info.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
name: _step.prepare_action_info
on:
workflow_call:
outputs:
build_publish:
value: ${{ jobs.prepare_build_info.outputs.build_publish }}
build_version_type:
value: ${{ jobs.prepare_build_info.outputs.build_version_type }}
publish_enable:
value: ${{ jobs.prepare_build_info.outputs.publish_enable }}
publish_platform_channel:
value: ${{ jobs.prepare_build_info.outputs.publish_platform_channel }}
publish_type:
value: ${{ jobs.prepare_build_info.outputs.publish_type }}
jobs:
prepare_build_info:
runs-on: ubuntu-24.04
outputs:
build_publish: ${{ steps.build_info.outputs.build_publish }}
build_version_type: ${{ steps.build_info.outputs.build_version_type }}
publish_enable: ${{ steps.build_info.outputs.publish_enable }}
publish_platform_channel: ${{ steps.build_info.outputs.publish_platform_channel }}
publish_type: ${{ steps.build_info.outputs.publish_type }}
steps:
- name: Checkout the sources
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Determining build info
id: build_info
env:
REPO_OWNER: ${{ github.repository_owner }}
GH_EVENT_NAME: ${{ github.event_name }}
run: |
# Publish to NyanMaven
build_publish=false
# Version Type
# BETA
# DEV
# FORK
# PULL_REQUEST
# RC
# RELEASE
build_version_type=DEV
# MC-Publish
publish_enable=false
# CurseForge / Modrinth Release Channel
# alpha
# beta
# release
publish_platform_channel=alpha
# Publish Type
# dev
# release
publish_type=dev
# Master Repo
# push
# true / BETA / true / alpha / dev
# pull_request
# false / PULL_REQUEST / false / - / -
# pre-release
# true / RC / true / beta / release
# release
# true / RELEASE / true / release / release
if [ "$REPO_OWNER" == 'Hendrix-Shen' ]
then
if [ "$GH_EVENT_NAME" == 'push' ]
then
build_publish=true
build_version_type=BETA
publish_enable=true
publish_platform_channel=alpha
elif [ "$GH_EVENT_NAME" == 'pull_request' ]
then
build_version_type=PULL_REQUEST
elif [ "$GH_EVENT_NAME" == 'release' ]
then
if [ ${{ github.event.release.prerelease }} ]
then
build_version_type=RC
publish_platform_channel=beta
else
build_version_type=RELEASE
publish_platform_channel=release
fi
build_publish=true
publish_enable=true
else
echo Unsupported github event name "$GH_EVENT_NAME"
exit 1
fi
# Nyan-Work (Test) Repo
# push
# true / DEV / false / - / dev
elif [ "$REPO_OWNER" == 'Nyan-Work' ]
then
if [ "$GH_EVENT_NAME" == 'push' ]
then
publish_enable=true
else
echo Unsupported github event name "$GH_EVENT_NAME"
exit 1
fi
# Fork Repos
# push
# true / FORK / false / - / dev
else
if [ "$GH_EVENT_NAME" == 'release' ]
then
build_version_type=FORK
publish_enable=true
else
echo Unsupported github event name "$GH_EVENT_NAME"
exit 1
fi
fi
echo "build_publish=$build_publish" >> $GITHUB_OUTPUT
echo "build_version_type=$build_version_type" >> $GITHUB_OUTPUT
echo "publish_channel=$publish_channel" >> $GITHUB_OUTPUT
echo "publish_enable=$publish_enable" >> $GITHUB_OUTPUT
echo "publish_platform_channel=$publish_platform_channel" >> $GITHUB_OUTPUT
echo "publish_type=$publish_type" >> $GITHUB_OUTPUT
cat <<EOF > $GITHUB_STEP_SUMMARY
## Determining build info
- build_publish: \`$build_publish\`
- build_version_type: \`$build_version_type\`
- publish_enable: \`$publish_enable\`
- publish_platform_channel: \`$publish_platform_channel\`
- publish_type: \`$publish_type\`
EOF