-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage.sh
More file actions
executable file
·44 lines (38 loc) · 1.34 KB
/
package.sh
File metadata and controls
executable file
·44 lines (38 loc) · 1.34 KB
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
#!/usr/bin/env bash
set -e
cd workdir
. ver
cd deb
sed -Ei "s/(nginx \()[0-9\.]+/\1$NGINX_VERSION/" debian/changelog
dpkg-buildpackage -b
cd ..
mv *.deb ../dist
cd rpm
sed -Ei "s/(Version: )[0-9\.]+/\1$NGINX_VERSION/" package.spec
rpmbuild \
-bb \
--define "_builddir $PWD/../core" \
--define "_sourcedir $PWD" \
--define "_rpmdir $PWD/../../dist" \
--define '_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \
package.spec
cd ..
cd ..
if [ -n "$CLOUDSMITH_API_KEY" ]; then
cd dist
for type in deb rpm; do
PACKAGE="$(find -name "*.$type" -exec basename {} \;)"
PACKAGE_IDENTIFIER="$(curl \
--header "Content-Sha256: $(sha256sum "$PACKAGE" | cut -d ' ' -f 1)" \
--user "$CLOUDSMITH_USERNAME:$CLOUDSMITH_API_KEY" \
--upload-file "$PACKAGE" \
"https://upload.cloudsmith.io/$CLOUDSMITH_NAMESPACE/$CLOUDSMITH_REPOSITORY/$PACKAGE" | jq -r '.identifier')"
curl \
--request POST \
--user "$CLOUDSMITH_USERNAME:$CLOUDSMITH_API_KEY" \
--header "Content-Type: application/json" \
--data "{\"distribution\":\"other$type/any-version\",\"package_file\":\"$PACKAGE_IDENTIFIER\"}" \
"https://api.cloudsmith.io/v1/packages/$CLOUDSMITH_NAMESPACE/$CLOUDSMITH_REPOSITORY/upload/$type/"
done
cd ..
fi