.
This commit is contained in:
parent
e288a28154
commit
9fdb979c26
@ -4,7 +4,7 @@
|
||||
|
||||
# 1. determines the architecture of the local machine
|
||||
|
||||
# 2. downloads the appropriate bb64 binary
|
||||
# 2. downloads the appropriate bb64 binary from the latest public release on Gitea (https://gitea.jde.nz/j/bb64/releases)
|
||||
|
||||
# 3. makes the bb64 binary executable
|
||||
|
||||
|
14
publish.sh
14
publish.sh
@ -40,9 +40,13 @@ REPO=$(echo "$REPO_URL" | sed -E 's#.*/([^/]+)(\.git)?$#\1#')
|
||||
|
||||
API_URL="$BASE_URL/api/v1/repos/$OWNER/$REPO"
|
||||
|
||||
# Check for GITEA_TOKEN
|
||||
if [ -z "$GITEA_TOKEN_DEPLOY" ]; then
|
||||
echo "GITEA_TOKEN_DEPLOY environment variable not set!" >&2
|
||||
# Check for GITEA_TOKEN_DEPLOY or GITEA_TOKEN
|
||||
if [ -n "$GITEA_TOKEN_DEPLOY" ]; then
|
||||
TOKEN="$GITEA_TOKEN_DEPLOY"
|
||||
elif [ -n "$GITEA_TOKEN" ]; then
|
||||
TOKEN="$GITEA_TOKEN"
|
||||
else
|
||||
echo "GITEA_TOKEN_DEPLOY or GITEA_TOKEN environment variable not set!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -60,7 +64,7 @@ EOF
|
||||
|
||||
RELEASE_ID=$(curl -s -X POST "$API_URL/releases" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: token $GITEA_TOKEN_DEPLOY" \
|
||||
-H "Authorization: token $TOKEN" \
|
||||
-d "$RELEASE_DATA" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
||||
|
||||
if [ -z "$RELEASE_ID" ]; then
|
||||
@ -73,7 +77,7 @@ for BIN in bb64.amd64 bb64.arm64; do
|
||||
if [ -f "output/$BIN" ]; then
|
||||
curl -s -X POST "$API_URL/releases/$RELEASE_ID/assets?name=$BIN" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
-H "Authorization: token $GITEA_TOKEN_DEPLOY" \
|
||||
-H "Authorization: token $TOKEN" \
|
||||
--data-binary @"output/$BIN"
|
||||
echo "Uploaded $BIN to release $TAG."
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user