Compare commits
5 Commits
21b486ceb0
...
v0.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 6b87c9e688 | |||
| f45342e379 | |||
| 929800bf68 | |||
| 5e8e7e4884 | |||
| bd4f230310 |
23
build.sh
23
build.sh
@@ -16,6 +16,12 @@ ARCHIVE_NAME="X11Proxy-${VERSION}-linux-x86_64.tar.gz"
|
||||
REPO="ezterry/X11Proxy"
|
||||
GITEA_URL="https://git-hojo.devnull.name"
|
||||
|
||||
if [[ -z "$VERSION" ]]; then
|
||||
echo "❌ Failed to extract version from main.go"
|
||||
echo "please fix the version constant in main.go"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "$BIN_NAME build script (version: $VERSION)"
|
||||
|
||||
# 🧹 Clean build artifacts
|
||||
@@ -44,6 +50,12 @@ build_dist() {
|
||||
|
||||
# 🚀 Publish release to Gitea
|
||||
publish_release() {
|
||||
#verify we will not run into an issue from a missing jq command
|
||||
command -v jq >/dev/null || {
|
||||
echo "❌ 'jq' is required but not installed. Please install it to continue."
|
||||
exit 1
|
||||
}
|
||||
|
||||
build_dist
|
||||
|
||||
echo "🔐 Enter Gitea token (will not be saved):"
|
||||
@@ -56,9 +68,10 @@ publish_release() {
|
||||
exit 1
|
||||
fi
|
||||
git tag -a "$TAG" -m "Release $TAG"
|
||||
git push origin $TAG
|
||||
|
||||
echo "📤 Creating release on Gitea..."
|
||||
curl -s -X POST "${GITEA_URL}/api/v1/repos/${REPO}/releases" \
|
||||
RELEASE_JSON=$(curl -s -X POST "${GITEA_URL}/api/v1/repos/${REPO}/releases" \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d @- <<EOF
|
||||
@@ -70,15 +83,17 @@ publish_release() {
|
||||
"prerelease": false
|
||||
}
|
||||
EOF
|
||||
)
|
||||
|
||||
echo "📎 Uploading asset..."
|
||||
curl -s -X POST "${GITEA_URL}/api/v1/repos/${REPO}/releases/${TAG}/assets" \
|
||||
RELEASE_ID=$(echo "$RELEASE_JSON" | jq -r '.id')
|
||||
|
||||
echo "📎 Uploading asset to release ID ${RELEASE_ID}..."
|
||||
curl -s -X POST "${GITEA_URL}/api/v1/repos/${REPO}/releases/${RELEASE_ID}/assets" \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-F name="${ARCHIVE_NAME}" \
|
||||
-F attachment=@"${ARCHIVE_NAME}"
|
||||
|
||||
echo "✅ Published release ${TAG} with asset ${ARCHIVE_NAME}"
|
||||
echo "📌 Remember to push the tag: git push origin ${TAG}"
|
||||
}
|
||||
|
||||
# 📖 Help message
|
||||
|
||||
Reference in New Issue
Block a user