-
Notifications
You must be signed in to change notification settings - Fork 12
/
bundle.sh
executable file
·121 lines (105 loc) · 2.9 KB
/
bundle.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
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
#!/bin/sh
prepare()
{
artifact=$1
version=$2
cd "$(dirname "$0")" || exit 1
mkdir -p "bundle"
rm -rf bundle/**
cp -af IPtProxy.aar bundle/${artifact}-${version}.aar
cp -af IPtProxy-sources.jar bundle/${artifact}-${version}-sources.jar
}
pom()
{
artifact=$1
version=$2
cat > bundle/${artifact}-${version}.pom <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<packaging>aar</packaging>
<groupId>com.netzarchitekten</groupId>
<artifactId>${artifact}</artifactId>
<version>${version}</version>
<name>IPtProxy</name>
<description>Obfs4proxy/Lyrebird and Snowflake Pluggable Transports for iOS, MacOS and Android</description>
<url>https://github.com/tladesignz/IPtProxy</url>
<inceptionYear>2020</inceptionYear>
<licenses>
<license>
<name>MIT</name>
<url>https://github.com/tladesignz/IPtProxy/blob/master/LICENSE</url>
<distribution>repo</distribution>
</license>
<license>
<name>GPL3</name>
<url>https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/lyrebird/-/raw/main/LICENSE-GPL3.txt</url>
<distribution>repo</distribution>
</license>
<license>
<name>BSD-3-clause</name>
<url>https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/raw/main/LICENSE</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>guardianproject</id>
<name>Guardian Project</name>
<email>[email protected]</email>
</developer>
<developer>
<id>torproject</id>
<name>Tor Project</name>
<email>[email protected]</email>
</developer>
</developers>
<scm>
<connection>scm:git:https://github.com/tladesignz/IPtProxy.git</connection>
<url>https://github.com/tladesignz/IPtProxy</url>
</scm>
<issueManagement>
<url>https://github.com/tladesignz/IPtProxy/issues</url>
<system>GitHub</system>
</issueManagement>
</project>
EOF
}
sign()
{
artifact=$1
version=$2
forceKey=""
if [ ! -z "$3" ]; then
forceKey="--local-user $3"
fi
if gpg --list-secret-keys | grep -Eo '[0-9A-F]{40}'; then
for f in bundle/${artifact}-*${version}*.*; do
gpg ${forceKey} --armor --detach-sign $f
done
fi
}
bundle()
{
artifact=$1
version=$2
file=bundle-${artifact}-${version}.jar
rm -f $file
cd bundle || exit 1
jar cvf ../$file ${artifact}-${version}*.*
cd ..
rm -r bundle
}
artifact=IPtProxy
version=$1
keyId=$2
if [ -z "$version" ]; then
echo "Usage: ./bundle.sh <semver> [<signing key ID>]"
exit
fi
prepare $artifact $version
pom $artifact $version
sign $artifact $version $keyId
bundle $artifact $version