Public Access
feat: added install logic
This commit is contained in:
9 files changed
+134
-18
No files matched your search
Executable
+49
@@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Usage: ./tools/publish-package.sh <version> <gitea-token>
|
||||
VERSION=$1
|
||||
TOKEN=$2
|
||||
MODULE="gitea.fernandovideira.com/fernandojvideira/keystone"
|
||||
# Note: The zip must contain the full domain path as the root directory
|
||||
ZIP_ROOT="${MODULE}@${VERSION}"
|
||||
API_URL="https://gitea.fernandovideira.com/api/packages/FernandoJVideira/go/upload"
|
||||
|
||||
if [ -z "$VERSION" ] || [ -z "$TOKEN" ]; then
|
||||
echo "Usage: $0 <version> <gitea-token>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "🚀 preparing release $VERSION..."
|
||||
|
||||
# 1. Generate the assets locally
|
||||
make prepare-embed
|
||||
|
||||
# 2. Create a temporary staging area
|
||||
TMP_DIR=$(mktemp -d)
|
||||
TARGET_DIR="$TMP_DIR/$ZIP_ROOT"
|
||||
mkdir -p "$TARGET_DIR"
|
||||
|
||||
# 3. Export clean git source to staging
|
||||
git archive --format=tar HEAD | tar -x -C "$TARGET_DIR"
|
||||
|
||||
# 4. Copy the generated (and git-ignored) assets into the staging area
|
||||
# We assume assets/embedded exists after 'make prepare-embed'
|
||||
mkdir -p "$TARGET_DIR/assets/embedded"
|
||||
cp -r assets/embedded/* "$TARGET_DIR/assets/embedded/"
|
||||
|
||||
# 5. Zip it up (using a custom Go tool to avoid directory entries)
|
||||
ZIP_FILE="keystone-$VERSION.zip"
|
||||
# We run the tool from the current directory, pointing it to the temp dir
|
||||
go run tools/create_zip.go "$TMP_DIR" "$ZIP_FILE"
|
||||
|
||||
# 6. Upload to Gitea
|
||||
echo "📦 Uploading to Gitea Package Registry..."
|
||||
curl --fail --silent --show-error \
|
||||
--user "FernandoJVideira:$TOKEN" \
|
||||
--upload-file "$ZIP_FILE" \
|
||||
"$API_URL"
|
||||
|
||||
# Cleanup
|
||||
rm -rf "$TMP_DIR" "$ZIP_FILE"
|
||||
echo "✅ Published $VERSION successfully!"
|
||||
Reference in new issue
Block a user