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