Skip to content

Commit c6f5a75

Browse files
committed
publish to bintray using tar.bz2 archive (to avoid hitting rate limit)
1 parent 44e09b6 commit c6f5a75

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

publish-zip.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env bash
2+
3+
# bash mode.
4+
set -e;
5+
6+
# source environment variables for the time being.
7+
source ./.env
8+
9+
# ensure variables exists from .env.
10+
ALPINE_VERSION=${ALPINE_VERSION}
11+
PHP_VERSION=${PHP_VERSION}
12+
PHP_MINOR_VERSION=${PHP_MINOR_VERSION}
13+
BINTRAY_USERNAME=${BINTRAY_USERNAME}
14+
BINTRAY_API_KEY=${BINTRAY_API_KEY}
15+
16+
# generate slug. in the "v3.12/php-8.0" format.
17+
REPO_SLUG=v${ALPINE_VERSION}/php-${PHP_VERSION}
18+
19+
# archive name to use.
20+
ARCHIVE_NAME=publish.tar.bz2
21+
22+
# find all .apk
23+
APK_LIST=$(find "./repo/${REPO_SLUG}" -name "*.apk" -type f | cut -d '/' -f5- | xargs)
24+
25+
# remove archive if exists.
26+
rm $ARCHIVE_NAME || echo "no existing ${ARCHIVE_NAME}."
27+
28+
# shellcheck disable=SC2086
29+
tar -cjvf "${ARCHIVE_NAME}" \
30+
--directory "repo/${REPO_SLUG}/" \
31+
$APK_LIST x86_64/APKINDEX.tar.gz
32+
33+
# upload after delete.
34+
curl \
35+
-X PUT \
36+
-u "${BINTRAY_USERNAME}:${BINTRAY_API_KEY}" \
37+
-H "X-Bintray-Package: php-${PHP_VERSION}" \
38+
-H "X-Bintray-Version: ${PHP_MINOR_VERSION}" \
39+
-H "X-Bintray-Publish: 1" \
40+
-H "X-Bintray-Override: 1" \
41+
-H "X-Bintray-Explode: 1" \
42+
-T "${ARCHIVE_NAME}" \
43+
"https://api.bintray.com/content/php-alpine/${REPO_SLUG}/"
44+
45+
# remove published archive package.
46+
rm $ARCHIVE_NAME

0 commit comments

Comments
 (0)