build: publish portable plugin releases
This commit is contained in:
parent
47c1db9979
commit
7e34a73835
|
|
@ -63,8 +63,10 @@ create a GitHub Release.
|
|||
The publisher requires an authenticated [`gh`](https://cli.github.com/) CLI
|
||||
and a clean, up-to-date `main`. It runs the local release command, creates and
|
||||
pushes an annotated tag if necessary, then creates or updates the GitHub
|
||||
Release with the archive and `SHA256SUMS`. Re-running it for a tag that points
|
||||
at the current commit replaces the release assets.
|
||||
Release with the Linux archive, Windows archive and `SHA256SUMS`. Alpha, beta
|
||||
and release-candidate tags are published as prereleases; stable tags are
|
||||
marked latest. Re-running it for a tag that points at the current commit
|
||||
replaces the release assets.
|
||||
|
||||
## License
|
||||
|
||||
|
|
|
|||
|
|
@ -39,15 +39,17 @@ fi
|
|||
|
||||
"$RELEASE_SCRIPT" "$VERSION"
|
||||
|
||||
shopt -s nullglob
|
||||
ASSETS=("$RELEASE_DIR"/*.tar.gz "$RELEASE_DIR"/*.tgz)
|
||||
if [[ -f "$RELEASE_DIR/SHA256SUMS" ]]; then
|
||||
ASSETS+=("$RELEASE_DIR/SHA256SUMS")
|
||||
fi
|
||||
if [[ ${#ASSETS[@]} -eq 0 ]]; then
|
||||
echo "no release assets found in $RELEASE_DIR" >&2
|
||||
ASSETS=(
|
||||
"$RELEASE_DIR/verstak-official-plugins-linux-amd64-$VERSION.tar.gz"
|
||||
"$RELEASE_DIR/verstak-official-plugins-windows-amd64-$VERSION.zip"
|
||||
"$RELEASE_DIR/SHA256SUMS"
|
||||
)
|
||||
for asset in "${ASSETS[@]}"; do
|
||||
if [[ ! -s "$asset" ]]; then
|
||||
echo "required release asset is missing or empty: $asset" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
if "$GIT_BIN" rev-parse -q --verify "refs/tags/$VERSION" >/dev/null; then
|
||||
if [[ "$("$GIT_BIN" rev-parse "${VERSION}^{commit}")" != "$HEAD" ]]; then
|
||||
|
|
@ -62,12 +64,16 @@ fi
|
|||
if "$GH_BIN" release view "$VERSION" --repo "$REPOSITORY" >/dev/null 2>&1; then
|
||||
"$GH_BIN" release upload "$VERSION" "${ASSETS[@]}" --repo "$REPOSITORY" --clobber
|
||||
else
|
||||
RELEASE_OPTIONS=(--generate-notes --verify-tag)
|
||||
if [[ "$VERSION" == *-* ]]; then
|
||||
RELEASE_OPTIONS+=(--prerelease)
|
||||
else
|
||||
RELEASE_OPTIONS+=(--latest)
|
||||
fi
|
||||
"$GH_BIN" release create "$VERSION" "${ASSETS[@]}" \
|
||||
--repo "$REPOSITORY" \
|
||||
--title "Verstak Official Plugins $VERSION" \
|
||||
--generate-notes \
|
||||
--latest \
|
||||
--verify-tag
|
||||
"${RELEASE_OPTIONS[@]}"
|
||||
fi
|
||||
|
||||
echo "GitHub release:"
|
||||
|
|
|
|||
|
|
@ -12,18 +12,4 @@ fi
|
|||
|
||||
echo "=== verstak official plugins release $VERSION ==="
|
||||
"$ROOT/scripts/check.sh"
|
||||
"$ROOT/scripts/build.sh"
|
||||
|
||||
RELEASE_ROOT="$ROOT/release"
|
||||
STAGING="$RELEASE_ROOT/verstak-official-plugins-$VERSION"
|
||||
ARCHIVE="$RELEASE_ROOT/verstak-official-plugins-$VERSION.tar.gz"
|
||||
rm -rf "$STAGING" "$ARCHIVE"
|
||||
mkdir -p "$STAGING"
|
||||
|
||||
cp "$ROOT/README.md" "$ROOT/LICENSE" "$STAGING/"
|
||||
cp -R "$ROOT/dist" "$STAGING/dist"
|
||||
tar -C "$RELEASE_ROOT" -czf "$ARCHIVE" "$(basename "$STAGING")"
|
||||
(cd "$RELEASE_ROOT" && sha256sum "$(basename "$ARCHIVE")" > SHA256SUMS)
|
||||
|
||||
echo "release archive: $ARCHIVE"
|
||||
echo "checksums: $RELEASE_ROOT/SHA256SUMS"
|
||||
"$ROOT/scripts/package-portable.sh" "$VERSION"
|
||||
|
|
|
|||
|
|
@ -17,5 +17,6 @@ grep -Fq 'verstak-official-plugins-windows-amd64-' "$PACKAGER"
|
|||
grep -Fq 'tar -C' "$PACKAGER"
|
||||
grep -Fq 'zip -qr' "$PACKAGER"
|
||||
grep -Fq 'SHA256SUMS' "$PACKAGER"
|
||||
grep -Fq 'package-portable.sh' "$ROOT/scripts/release.sh"
|
||||
|
||||
echo "portable plugin package script contract passed"
|
||||
|
|
|
|||
|
|
@ -5,7 +5,10 @@ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|||
PUBLISHER="$ROOT/scripts/publish-github-release.sh"
|
||||
VERSION="v0.0.0-test"
|
||||
REPOSITORY="mirivlad/verstak-official-plugins"
|
||||
ASSET_NAME="verstak-official-plugins-${VERSION}.tar.gz"
|
||||
ASSET_NAMES=(
|
||||
"verstak-official-plugins-linux-amd64-v0.0.0-test.tar.gz"
|
||||
"verstak-official-plugins-windows-amd64-v0.0.0-test.zip"
|
||||
)
|
||||
WORK="$(mktemp -d)"
|
||||
trap 'rm -rf "$WORK"' EXIT
|
||||
|
||||
|
|
@ -22,7 +25,8 @@ cat > "$WORK/release.sh" <<'SCRIPT'
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
printf 'release:%s\n' "$1" >> "$LOG"
|
||||
printf 'archive\n' > "$VERSTAK_RELEASE_DIR/verstak-official-plugins-$1.tar.gz"
|
||||
printf 'linux\n' > "$VERSTAK_RELEASE_DIR/verstak-official-plugins-linux-amd64-$1.tar.gz"
|
||||
printf 'windows\n' > "$VERSTAK_RELEASE_DIR/verstak-official-plugins-windows-amd64-$1.zip"
|
||||
printf 'checksum\n' > "$VERSTAK_RELEASE_DIR/SHA256SUMS"
|
||||
SCRIPT
|
||||
chmod +x "$WORK/release.sh"
|
||||
|
|
@ -82,8 +86,11 @@ grep -Fqx "release:$VERSION" "$LOG"
|
|||
grep -Fqx "tag:$VERSION" "$LOG"
|
||||
grep -Fqx "push:origin:refs/tags/$VERSION" "$LOG"
|
||||
grep -F "release create $VERSION" "$LOG" >/dev/null
|
||||
grep -F "$ASSET_NAME" "$LOG" >/dev/null
|
||||
for asset in "${ASSET_NAMES[@]}"; do
|
||||
grep -F "$asset" "$LOG" >/dev/null
|
||||
done
|
||||
grep -F "SHA256SUMS" "$LOG" >/dev/null
|
||||
grep -F -- "--prerelease" "$LOG" >/dev/null
|
||||
|
||||
run_publisher
|
||||
grep -F "release upload $VERSION" "$LOG" >/dev/null
|
||||
|
|
|
|||
Loading…
Reference in New Issue