Update .forgejo/workflows/release.yaml
Some checks failed
Run Integration Tests / test (push) Has been cancelled
Some checks failed
Run Integration Tests / test (push) Has been cancelled
This commit is contained in:
parent
45bc8147b2
commit
6e30691dad
1 changed files with 49 additions and 23 deletions
|
@ -30,6 +30,8 @@ jobs:
|
|||
|
||||
- name: Build all targets
|
||||
run: |
|
||||
mkdir -p bundles
|
||||
|
||||
PLATFORMS=(
|
||||
"linux/amd64"
|
||||
"linux/arm64"
|
||||
|
@ -47,9 +49,17 @@ jobs:
|
|||
|
||||
OUT="qgato-${OS}-${ARCH}"
|
||||
[ -n "$VARIANT" ] && OUT="${OUT}${VARIANT}"
|
||||
[ "$OS" = "windows" ] && OUT="${OUT}.exe"
|
||||
BIN="$OUT"
|
||||
[ "$OS" = "windows" ] && BIN="${OUT}.exe"
|
||||
|
||||
echo "🔨 Building $OUT"
|
||||
echo "🔨 Building $BIN"
|
||||
|
||||
# Disable CGO for cross-compiled targets (everything except native linux/amd64)
|
||||
if [ "$TARGET" = "linux/amd64" ]; then
|
||||
export CGO_ENABLED=1
|
||||
else
|
||||
export CGO_ENABLED=0
|
||||
fi
|
||||
|
||||
if [ "$ARCH" = "arm" ]; then
|
||||
case "$VARIANT" in
|
||||
|
@ -58,11 +68,26 @@ jobs:
|
|||
*) GOARM=7 ;;
|
||||
esac
|
||||
GOOS=$OS GOARCH=arm GOARM=$GOARM \
|
||||
go build -ldflags="-s -w" -o "$OUT" ./.
|
||||
go build -ldflags="-s -w" -o "$BIN" ./.
|
||||
else
|
||||
GOOS=$OS GOARCH=$ARCH \
|
||||
go build -ldflags="-s -w" -o "$OUT" ./.
|
||||
go build -ldflags="-s -w" -o "$BIN" ./.
|
||||
fi
|
||||
|
||||
echo "📦 Packaging $BIN with required files..."
|
||||
|
||||
PKG_DIR="bundle-$OUT"
|
||||
mkdir "$PKG_DIR"
|
||||
cp "$BIN" "$PKG_DIR/"
|
||||
cp -r lang static templates config.ini "$PKG_DIR/" 2>/dev/null || true
|
||||
|
||||
if [ "$OS" = "windows" ]; then
|
||||
zip -r "bundles/$OUT.zip" "$PKG_DIR"
|
||||
else
|
||||
tar -czf "bundles/$OUT.tar.gz" "$PKG_DIR"
|
||||
fi
|
||||
|
||||
rm -rf "$PKG_DIR" "$BIN"
|
||||
done
|
||||
|
||||
- name: Create Forgejo release
|
||||
|
@ -72,13 +97,13 @@ jobs:
|
|||
|
||||
DOWNLOAD_BASE="https://weforge.xyz/spitfire/Search/releases/download/$TAG_NAME"
|
||||
|
||||
echo "| Arch | Linux | Windows |" > release.md
|
||||
echo "|-----------|------------------------------------------|----------------------------------------------|" >> release.md
|
||||
echo "| amd64 | [qgato-linux-amd64]($DOWNLOAD_BASE/qgato-linux-amd64) | [qgato-windows-amd64.exe]($DOWNLOAD_BASE/qgato-windows-amd64.exe) |" >> release.md
|
||||
echo "| arm64 | [qgato-linux-arm64]($DOWNLOAD_BASE/qgato-linux-arm64) | [qgato-windows-arm64.exe]($DOWNLOAD_BASE/qgato-windows-arm64.exe) |" >> release.md
|
||||
echo "| armv7 | [qgato-linux-armv7]($DOWNLOAD_BASE/qgato-linux-armv7) | — |" >> release.md
|
||||
echo "| armv6 | [qgato-linux-armv6]($DOWNLOAD_BASE/qgato-linux-armv6) | — |" >> release.md
|
||||
echo "| riscv64 | [qgato-linux-riscv64]($DOWNLOAD_BASE/qgato-linux-riscv64) | — |" >> release.md
|
||||
echo "| Arch | Linux Bundle (.tar.gz) | Windows Bundle (.zip) |" > release.md
|
||||
echo "|---------|---------------------------------------------------|--------------------------------------------------|" >> release.md
|
||||
echo "| amd64 | [qgato-linux-amd64.tar.gz]($DOWNLOAD_BASE/qgato-linux-amd64.tar.gz) | [qgato-windows-amd64.zip]($DOWNLOAD_BASE/qgato-windows-amd64.zip) |" >> release.md
|
||||
echo "| arm64 | [qgato-linux-arm64.tar.gz]($DOWNLOAD_BASE/qgato-linux-arm64.tar.gz) | [qgato-windows-arm64.zip]($DOWNLOAD_BASE/qgato-windows-arm64.zip) |" >> release.md
|
||||
echo "| armv7 | [qgato-linux-armv7.tar.gz]($DOWNLOAD_BASE/qgato-linux-armv7.tar.gz) | — |" >> release.md
|
||||
echo "| armv6 | [qgato-linux-armv6.tar.gz]($DOWNLOAD_BASE/qgato-linux-armv6.tar.gz) | — |" >> release.md
|
||||
echo "| riscv64 | [qgato-linux-riscv64.tar.gz]($DOWNLOAD_BASE/qgato-linux-riscv64.tar.gz) | — |" >> release.md
|
||||
|
||||
RELEASE_BODY=$(cat release.md | jq -Rs .)
|
||||
|
||||
|
@ -98,26 +123,27 @@ jobs:
|
|||
REPO: Search
|
||||
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
||||
|
||||
- name: Upload all binaries
|
||||
- name: Upload all bundles
|
||||
run: |
|
||||
TAG_NAME=$(cat version.txt)
|
||||
RELEASE_ID=$(curl -s -H "Authorization: token $FORGEJO_TOKEN" \
|
||||
"$FORGEJO_API/repos/${OWNER}/${REPO}/releases/tags/$TAG_NAME" | jq -r .id)
|
||||
|
||||
for BIN in qgato-*; do
|
||||
echo "📤 Uploading $BIN"
|
||||
CONTENT_TYPE="application/octet-stream"
|
||||
case "$BIN" in
|
||||
*.exe) CONTENT_TYPE="application/vnd.microsoft.portable-executable" ;;
|
||||
esac
|
||||
for FILE in bundles/*; do
|
||||
NAME=$(basename "$FILE")
|
||||
echo "📤 Uploading $NAME"
|
||||
|
||||
curl -sSL -X POST "$FORGEJO_API/repos/${OWNER}/${REPO}/releases/${RELEASE_ID}/assets?name=$BIN" \
|
||||
CONTENT_TYPE="application/octet-stream"
|
||||
[[ "$FILE" == *.zip ]] && CONTENT_TYPE="application/zip"
|
||||
[[ "$FILE" == *.tar.gz ]] && CONTENT_TYPE="application/gzip"
|
||||
|
||||
curl -sSL -X POST "$FORGEJO_API/repos/${OWNER}/${REPO}/releases/${RELEASE_ID}/assets?name=$NAME" \
|
||||
-H "Authorization: token $FORGEJO_TOKEN" \
|
||||
-H "Content-Type: $CONTENT_TYPE" \
|
||||
--data-binary "@$BIN"
|
||||
--data-binary "@$FILE"
|
||||
done
|
||||
env:
|
||||
FORGEJO_API: https://weforge.xyz/api/v1
|
||||
OWNER: partisan
|
||||
REPO: qgato
|
||||
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
||||
OWNER: spitfire
|
||||
REPO: Search
|
||||
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
Loading…
Add table
Add a link
Reference in a new issue