-
Notifications
You must be signed in to change notification settings - Fork 55
/
locally_verify_release_ci.sh
61 lines (50 loc) · 2.08 KB
/
locally_verify_release_ci.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
61
cd BuildCI
for line in $(dotnet run --configuration Release Program.cs); do
IFS='|' read -ra parts <<< "$line"
namespace=${parts[0]}
name_underscore_separator=${parts[1]}
version=${parts[2]}
csproj_folder=${parts[3]}
nuget_package_name=${parts[4]}
cd $csproj_folder
is_project_built=false
existing_version_number=$(curl --compressed -s "https://api-v2v3search-0.nuget.org/query?q=packageid:${nuget_package_name}&prerelease=true&semVerLevel=2.0.0" | jq '.data[0]?.versions[]?.version' | grep "${version}\"" || true)
if [ -z $existing_version_number ]
then
dotnet pack --configuration Release /p:PackageOutputPath=./ReleaseOutput /p:OutputPath=./ReleaseOutput
is_project_built=true
if [ "$namespace" == "RiskofThunder" ]; then
#nuget setapikey "${{ secrets.NUGET_API_KEY_RISK_OF_THUNDER }}"
echo "setapikey"
else
#nuget setapikey "${{ secrets.NUGET_API_KEY }}"
echo "setapikey"
fi
#nuget push ./ReleaseOutput/*.nupkg -Source 'https://api.nuget.org/v3/index.json'
echo "nuget push 1"
#find . -name '*.nupkg' -type f -delete
fi
existing_version_number=$(curl --compressed -s "https://thunderstore.io/api/v1/package/" | jq --arg package_name "$namespace-$name_underscore_separator" '.[]? | select(.full_name|startswith($package_name)) | .versions[0]?.version_number' | grep "${version}\"" || true)
if [ -z $existing_version_number ]
then
if [ "$is_project_built" = false ] ; then
dotnet pack --configuration Release /p:PackageOutputPath=./ReleaseOutput /p:OutputPath=./ReleaseOutput
is_project_built=true
fi
find . -name '*.pdb' -type f -delete
find . -name '*.deps.json' -type f -delete
if [ "$namespace" == "RiskofThunder" ]; then
#tcli publish --token ${{ secrets.TCLI_AUTH_TOKEN_RISK_OF_THUNDER }}
echo "tcli publish 1"
else
#tcli publish --token ${{ secrets.TCLI_AUTH_TOKEN }}
echo "tcli publish 2"
fi
#rm -rf ./build
echo "rm -rf ./build"
fi
if [ "$is_project_built" = true ] ; then
#rm -rf ./ReleaseOutput
echo "rm -rf ./ReleaseOutput"
fi
done