⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
ci(cli): stop on an unfinished release instead of repairing it
Andrejd833584d35e3
diff --git a/.github/workflows/publish-cli.yml b/.github/workflows/publish-cli.ymlindex 21689a0cd..3209dd4f9 100644--- a/.github/workflows/publish-cli.yml+++ b/.github/workflows/publish-cli.yml@@ -33,7 +33,7 @@ jobs:outputs:version: ${{ steps.release.outputs.version }}prerelease: ${{ steps.release.outputs.prerelease }}- release_state: ${{ steps.release.outputs.release_state }}+ release_exists: ${{ steps.release.outputs.release_exists }}steps:- name: Checkout repository@@ -99,18 +99,23 @@ jobs:if release=$(gh release view "$tag" --repo "$GITHUB_REPOSITORY" --json assets,isDraft,isPrerelease 2> "$RUNNER_TEMP/release-view.err"); thenread -ra expected <<< "$CLI_ASSETS"present=$(jq -r '.assets[].name' <<< "$release")- missing=$(comm -23 <(printf '%s\n' "${expected[@]}" SHA256SUMS | sort) <(printf '%s\n' "$present" | sort) | tr '\n' ' ')- draft=$(jq -r '.isDraft' <<< "$release")- published_prerelease=$(jq -r '.isPrerelease' <<< "$release")- if [ -z "$missing" ] && [ "$draft" = false ] && [ "$published_prerelease" = "$prerelease" ]; then- state=complete- echo "Release $tag is published with every asset; skipping binaries and release."- else- state=incomplete- echo "Release $tag needs repair (missing: ${missing:-none}, draft: $draft, prerelease: $published_prerelease)."+ missing=$(comm -23 <(printf '%s\n' "${expected[@]}" SHA256SUMS | sort) <(printf '%s\n' "$present" | sort) | paste -sd ' ' -)+ if [ -n "$missing" ]; then+ echo "::error::Release $tag exists without every asset (missing: $missing). Delete it with \"gh release delete $tag --cleanup-tag\" and run this workflow again."+ exit 1fi+ if [ "$(jq -r '.isDraft' <<< "$release")" != false ]; then+ echo "::error::Release $tag is still a draft. Publish it with \"gh release edit $tag --draft=false\"."+ exit 1+ fi+ if [ "$(jq -r '.isPrerelease' <<< "$release")" != "$prerelease" ]; then+ echo "::error::Release $tag should have prerelease set to $prerelease. Fix it with \"gh release edit $tag --prerelease=$prerelease\"."+ exit 1+ fi+ exists=true+ echo "Release $tag is already published with every asset; skipping binaries and release."elif grep -q "release not found" "$RUNNER_TEMP/release-view.err"; then- state=missing+ exists=falseelsecat "$RUNNER_TEMP/release-view.err" >&2exit 1@@ -118,13 +123,13 @@ jobs:{echo "version=$version"echo "prerelease=$prerelease"- echo "release_state=$state"+ echo "release_exists=$exists"} >> "$GITHUB_OUTPUT"binaries:name: Compile ${{ matrix.platform }} binariesneeds: check- if: needs.check.outputs.release_state != 'complete'+ if: needs.check.outputs.release_exists == 'false'runs-on: ${{ matrix.runner }}permissions:contents: read@@ -207,7 +212,7 @@ jobs:release:name: Create GitHub releaseneeds: [check, binaries]- if: needs.check.outputs.release_state != 'complete'+ if: needs.check.outputs.release_exists == 'false'runs-on: ubuntu-24.04permissions:contents: write@@ -235,18 +240,8 @@ jobs:GH_TOKEN: ${{ github.token }}VERSION: ${{ needs.check.outputs.version }}PRERELEASE: ${{ needs.check.outputs.prerelease }}- RELEASE_STATE: ${{ needs.check.outputs.release_state }}run: |set -euo pipefail- if [ "$RELEASE_STATE" = incomplete ]; then- gh release upload "cli-v$VERSION" assets/* --repo "$GITHUB_REPOSITORY" --clobber- gh release edit "cli-v$VERSION" \- --repo "$GITHUB_REPOSITORY" \- --draft=false \- --prerelease="$PRERELEASE" \- --latest=false- exit 0- finotes="$RUNNER_TEMP/notes.md"cat > "$notes" <<'EOF'Install or update the Kaneo CLI on macOS and Linux: