diff --git a/v2ray/scripts/publish.sh b/v2ray/scripts/publish.sh index 8a064b2..2cbd5a8 100644 --- a/v2ray/scripts/publish.sh +++ b/v2ray/scripts/publish.sh @@ -5,4 +5,32 @@ mkdir -p out nfpm package --config /pkg/nfpm.yaml --packager deb --target /pkg/out/ echo "✓ built $(ls out/*.deb)" -ls -la out/ \ No newline at end of file +ls -la out/ + + +DEB=$(ls /pkg/out/*.deb | head -1) +FILENAME=$(basename "$DEB") + +DISTRIBUTION="bookworm" +COMPONENT="main" + +echo "↑ publishing ${FILENAME}..." + +HTTP_CODE=$(curl -fsSL \ + -w "%{http_code}" \ + -o /tmp/publish_response.txt \ + -X PUT \ + -H "Authorization: token ${GITEA_TOKEN}" \ + -H "Content-Type: application/octet-stream" \ + --data-binary "@${DEB}" \ + "${GITEA_URL}/api/packages/${GITEA_OWNER}/debian/pool/${DISTRIBUTION}/${COMPONENT}/upload") + +cat /tmp/publish_response.txt +echo "" + +if [[ "$HTTP_CODE" =~ ^2 ]]; then + echo "✓ published ${FILENAME} (HTTP ${HTTP_CODE})" +else + echo "✗ failed (HTTP ${HTTP_CODE})" + exit 1 +fi \ No newline at end of file