diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cfc8345..5da99a7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -79,7 +79,14 @@ jobs: id-token: write steps: - - name: Download the released VSIX + - name: Validate release tag + env: + RELEASE_TAG: ${{ inputs.tag }} + run: | + set -euo pipefail + [[ "$RELEASE_TAG" =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]] + + - name: Download and verify the released VSIX env: GH_TOKEN: ${{ github.token }} RELEASE_TAG: ${{ inputs.tag }} @@ -90,9 +97,19 @@ jobs: gh release download "$RELEASE_TAG" \ --repo "$GITHUB_REPOSITORY" \ --pattern "$VSIX" \ - --pattern "$VSIX.sha256" \ --dir .release - (cd .release && sha256sum -c "$VSIX.sha256") + gh release view "$RELEASE_TAG" \ + --repo "$GITHUB_REPOSITORY" \ + --json assets > release-assets.json + expected="$(jq -r --arg name "$VSIX" '.assets[] | select(.name == $name) | .digest' release-assets.json)" + test -n "$expected" + test "$expected" != "null" + actual="sha256:$(sha256sum ".release/$VSIX" | awk '{print $1}')" + test "$actual" = "$expected" + unzip -p ".release/$VSIX" extension/package.json > vsix-package.json + test "$(jq -r '.publisher' vsix-package.json)" = "mikesoft" + test "$(jq -r '.name' vsix-package.json)" = "vscode-kimi-code-cli-launcher" + test "$(jq -r '.version' vsix-package.json)" = "${RELEASE_TAG#v}" - name: Publish to Visual Studio Marketplace env: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f0b526e..669ba0f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -117,6 +117,6 @@ the GitHub release exists, dispatch the `Release` workflow with that release tag gh workflow run release.yml -f tag=v ``` -The publish job downloads the released VSIX, verifies its checksum, and publishes it to both registries -with short-lived OIDC credentials. No registry publisher token is stored in the repository, local -automation, or GitHub Actions secrets. +The publish job downloads the released VSIX, verifies its SHA-256 against the digest recorded on the +GitHub release asset, and publishes it to both registries with short-lived OIDC credentials. No +registry publisher token is stored in the repository, local automation, or GitHub Actions secrets.