-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: upload apt/rpm/apk packages to fury.io for publishing (#107)
We're going to use `fury.io` to host our packages so users don't have to manually download a `deb`, `rpm`, `apk` file everytime.
- Loading branch information
1 parent
91016c6
commit eae8eac
Showing
3 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env bash | ||
# Originally adapated from: | ||
# https://github.com/goreleaser/goreleaser/blob/main/scripts/fury-upload.sh | ||
set -euo pipefail | ||
|
||
# FURY_PUSH_TOKEN is a secret token that is used to push packages to | ||
# fury (https://fury.io). It is a required environment variable. | ||
FURY_PUSH_TOKEN="${FURY_PUSH_TOKEN}" | ||
|
||
# allowed_exts is an array of allowed file extensions that can be | ||
# uploaded to fury. | ||
allowed_exts=("deb" "rpm" "apk") | ||
|
||
# Get the file extension | ||
file_ext="${1##*.}" | ||
|
||
is_allowed=false | ||
for ext in "${allowed_exts[@]}"; do | ||
if [[ "$ext" == "$file_ext" ]]; then | ||
is_allowed=true | ||
break | ||
fi | ||
done | ||
|
||
if [[ "$is_allowed" == "false" ]]; then | ||
exit 0 | ||
fi | ||
|
||
cd dist | ||
echo "uploading $1" | ||
status="$(curl -s -q -o /dev/null -w "%{http_code}" -F package="@$1" "https://${FURY_PUSH_TOKEN}@push.fury.io/rgst-io/")" | ||
echo "got: $status" | ||
if [[ "$status" == "200" ]] || [[ "$status" == "409" ]]; then | ||
exit 0 | ||
fi | ||
|
||
# Otherwise, exit with an error | ||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters