-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.sh
executable file
·60 lines (47 loc) · 1.88 KB
/
build.sh
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
#!/bin/bash
## https://github.com/Ryzhehvost/asf_plugin_creator
################################################################################
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$HOME/bin
export PATH
################################################################################
_PROGN_=`basename $0`
_INSTDIR_=`dirname $0`
[[ $_INSTDIR_ = . ]] && _INSTDIR_=`pwd`
################################################################################
## getting current directory name from '$_INSTDIR_' variable
plugin_name=$(echo $_INSTDIR_ | sed 's|.*/||')
# download submodule
if [[ ! -d ArchiSteamFarm/ArchiSteamFarm ]]; then
git submodule update --init
fi
if [[ $# -gt 1 ]]; then
echo "Too many arguments. Exiting."
exit 1
elif [[ $# -eq 1 ]]; then
## update submodule to required tag as specified in '$1'
git submodule foreach "git fetch origin; git checkout $1;"
else
## otherwise update submodule to latest tag
git submodule foreach "git fetch origin; git checkout $(git rev-list --tags --max-count=1);"
fi
## print what version we are building for
git submodule foreach "git describe --tags;"
if [[ -d ./out ]]; then
rm -rf ./out
fi
## release generic version
dotnet restore
sync
dotnet publish FreePackages -c "Release" -f net9.0 -o "out/generic" "/p:LinkDuringPublish=false"
mkdir ./out/$plugin_name
cp ./out/generic/$plugin_name.dll ./out/$plugin_name
( cd ./out/generic ; cp --parents ./*/$plugin_name.resources.dll ../../out/$plugin_name || : )
if [[ -f "README.md" ]]; then
if ! command -v pandoc &> /dev/null; then
cp README.md ./out/$plugin_name
else
pandoc --metadata title="$plugin_name" --standalone --columns 2000 -f markdown -t html --embed-resources --standalone -c ./github-pandoc.css -o ./out/$plugin_name/README.html README.md
fi
fi
7z a -tzip -mx7 ./out/$plugin_name.zip ./out/$plugin_name
rm -rf out/$plugin_name