diff --git a/.github/workflows/release.yml b/.github/workflows/release.yaml similarity index 71% rename from .github/workflows/release.yml rename to .github/workflows/release.yaml index ee44aa54..9e6883fd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yaml @@ -18,13 +18,6 @@ jobs: with: ref: main - - name: Validate CHANGELOG entry - run: | - if ! grep -q "## v${{ inputs.version }}" CHANGELOG.md; then - echo "::error::Missing CHANGELOG entry for v${{ inputs.version }}" - exit 1 - fi - - name: Validate version.txt run: | if ! grep -q "${{ inputs.version }}" cmd/scip/version.txt; then @@ -36,22 +29,34 @@ jobs: run: | TAG="v${{ inputs.version }}" BINDINGS_TAG="bindings/go/scip/$TAG" - git tag "$TAG" 2>/dev/null || echo "Tag $TAG already exists" - git tag "$BINDINGS_TAG" 2>/dev/null || echo "Tag $BINDINGS_TAG already exists" + for t in "$TAG" "$BINDINGS_TAG"; do + if git rev-parse "$t" &>/dev/null; then + if [ "$(git rev-parse "$t"^{})" != "$(git rev-parse HEAD)" ]; then + echo "::error::Tag $t exists but points to a different commit" + exit 1 + fi + echo "Tag $t already exists at HEAD, skipping" + else + git tag "$t" + fi + done git push origin "$TAG" "$BINDINGS_TAG" 2>/dev/null || echo "Tags already pushed" - - name: Create GitHub release + - name: Create draft GitHub release env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | TAG="v${{ inputs.version }}" if gh release view "$TAG" &>/dev/null; then - echo "Release $TAG already exists, skipping creation" + DRAFT=$(gh release view "$TAG" --json isDraft -q '.isDraft') + if [ "$DRAFT" = "false" ]; then + echo "::error::Release $TAG is already published" + exit 1 + fi + echo "Draft release $TAG already exists, skipping creation" exit 0 fi { - echo "See the [CHANGELOG](https://github.com/scip-code/scip/blob/main/CHANGELOG.md) to see what's new in scip $TAG." - echo '' echo 'Download the CLI for your current platform using:' echo '' echo '```bash' @@ -62,7 +67,7 @@ jobs: echo ' bash -c '"'"'curl -L "https://github.com/scip-code/scip/releases/download/$TAG/scip-$OS-$ARCH.tar.gz"'"'"' \' echo '| tar xzf - scip' echo '```' - } | gh release create "$TAG" --title "scip $TAG" --notes-file - + } | gh release create "$TAG" --title "scip $TAG" --generate-notes --draft --notes-file - release-crate: needs: publish @@ -135,4 +140,23 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} ASSET: ${{ matrix.asset_name }} - run: gh release upload "v${{ inputs.version }}" "$ASSET.tar.gz" "$ASSET.tar.gz.sha256" --clobber + run: | + TAG="v${{ inputs.version }}" + DRAFT=$(gh release view "$TAG" --json isDraft -q '.isDraft') + if [ "$DRAFT" = "false" ]; then + echo "::error::Release $TAG is already published, refusing to upload" + exit 1 + fi + gh release upload "$TAG" "$ASSET.tar.gz" "$ASSET.tar.gz.sha256" --clobber + + finalize-release: + needs: [release-crate, build-go-binaries] + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v6 + - name: Mark release as non-draft + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: gh release edit "v${{ inputs.version }}" --draft=false diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 88755b6f..00000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,253 +0,0 @@ -# ChangeLog - -## v0.7.1 - -Go bindings: - -- Render external symbols in snapshot outputs. - (https://github.com/scip-code/scip/pull/390) -- Render `display_name` and `signature_documentation` in snapshots. - (https://github.com/scip-code/scip/pull/391) - -## v0.7.0 - -General: - -- BREAKING CHANGE: The project has moved from `sourcegraph/scip` to `scip-code/scip`. - All import paths and references have been updated accordingly. - (https://github.com/scip-code/scip/pull/377) -- All bindings (Go, Rust, TypeScript, Haskell) now follow the same - version number as the repository. -- Adopted Nix for building and CI. - (https://github.com/scip-code/scip/pull/356) -- Removed all LSIF references now that LSIF is fully deprecated. - (https://github.com/scip-code/scip/pull/369) - -Go bindings: - -- BREAKING CHANGE: Go bindings have been split into a separate module - at `github.com/scip-code/scip/bindings/go/scip` to reduce - the dependency footprint for consumers. - (https://github.com/scip-code/scip/pull/364, - https://github.com/scip-code/scip/pull/371) -- Removed old V1 symbol parser, speedtest, and sample indexes. - (https://github.com/scip-code/scip/pull/365) -- Updated protoc-gen-go from v1.31.0 to v1.36.6. - (https://github.com/scip-code/scip/pull/358) - -Rust bindings: - -- Fixed symbol formatting to use character count instead of byte length, - fixing issues with multibyte identifiers. - (https://github.com/scip-code/scip/pull/346) -- Fixed symbol backtick escaping to match the Go implementation. - (https://github.com/scip-code/scip/pull/368) - -TypeScript bindings: - -- BREAKING CHANGE: Migrated protobuf bindings from protoc-gen-ts to protobuf-es. - (https://github.com/scip-code/scip/pull/361) - -## v0.6.1 - -Go bindings: - -- Added support for enclosing ranges -- Added syntax kinds to testutil output - -## v0.6.0 - -Rust SCIP bindings: - -- Bumped MSRV to Rust 1.81.0 (https://github.com/sourcegraph/scip/pull/316, https://github.com/sourcegraph/scip/pull/313). -- Bumped the pinned version of the `protobuf` crate to - the latest release v3.7.2. - (https://github.com/sourcegraph/scip/pull/313) - -Go bindings: - -- Symbol parsing logic doesn't panic on multibyte code points. -- BREAKING CHANGE: IndexVisitor now accepts a context object and returns an error. - When an error is returned, the visitor short-circuits. - -CLI: - -- The `test` command now has a `--check-documents` flag. - -## v0.5.2 - -SCIP schema: - -- Added kind `SymbolInformation.Kind.Concept` for C++ (https://github.com/sourcegraph/scip/pull/305) - -## v0.5.1 - -CLI: - -- Cleaned up the formatting for the `test` command. - (https://github.com/sourcegraph/scip/pull/281) - -Rust SCIP bindings: - -- Bumped the pinned version of the `protobuf` crate to - the latest release v3.7.1. - (https://github.com/sourcegraph/scip/pull/287) - -## v0.5.0 - -CLI: - -- Added a `test` command for targeted testing of specific occurrences. - See the [CLI](docs/CLI.md) and [test file syntax reference](docs/test_file_format.md) for details. - (https://github.com/sourcegraph/scip/pull/236) -- Breaking changes: - - Removed the `convert` subcommand for SCIP to LSIF conversion. - (https://github.com/sourcegraph/scip/pull/275) - -Schema: - -- Added two new `SymbolKind` variants: `Extension` and `Mixin`. - (https://github.com/sourcegraph/scip/pull/277) - -Go SCIP bindings: - -- Added clearer documentation around document canonicalization. - (https://github.com/sourcegraph/scip/pull/273) -- Breaking changes: - - Removed SCIP to LSIF conversion functionality. - (https://github.com/sourcegraph/scip/pull/275) - -## v0.4.0 - -SCIP schema: - -- Added documentation that ranges must be half-open intervals. - -Go SCIP bindings: - -- Breaking changes: - - The `NewRange` function does well-formedness checks and returns `(Range, error)` instead of `*Range`. - When skipping checks, `NewRangeUnchecked` can be used instead. - - The `SortRanges` function takes a `[]Range` instead of a `[]*Range` - to avoid extra heap allocations. -- Features: - - Added new methods for `Range` and `Position` types. - -## v0.3.3 - -SCIP schema: - -- Added new `PositionEncoding` field to specify how consumers - should interpret the character offsets. - (https://github.com/sourcegraph/scip/pull/224, https://github.com/sourcegraph/scip/pull/225) - -scip CLI: - -- `scip snapshot` output includes the `diagnostics` field. - -## v0.3.2 - -SCIP schema: - -- Added new `SymbolRole`: `ForwardDefinition` - (https://github.com/sourcegraph/scip/pull/217) - -scip CLI: - -- `scip print` supports turning off colorful output using `--color=false` or - by setting the environment variable `NO_COLOR=1`. - (https://github.com/sourcegraph/scip/pull/214) - -## v0.3.1 - -SCIP schema: - -- Added new `Kind` enum constants to represent more detailed - information about different pieces of syntax in different languages. - (https://github.com/sourcegraph/scip/pull/195, - https://github.com/sourcegraph/scip/pull/208, - https://github.com/sourcegraph/scip/pull/209) -- Added new `Language` enum constants. - (https://github.com/sourcegraph/scip/pull/195, - https://github.com/sourcegraph/scip/pull/207) -- Minor documentation improvements. - (https://github.com/sourcegraph/scip/pull/194, - https://github.com/sourcegraph/scip/pull/206) - -scip CLI: - -- Added a new `--project-root` flag to `scip stats`. - (https://github.com/sourcegraph/scip/pull/187) - -Go bindings: - -- Added missing validation for local symbols when - parsing a symbol string. - (https://github.com/sourcegraph/scip/pull/206) -- Fixed a bug related to escaping in symbol formatting. - (https://github.com/sourcegraph/scip/pull/186) - (https://github.com/sourcegraph/scip/pull/206) -- Fixed a bug in occurrence canonicalization. - (https://github.com/sourcegraph/scip/pull/180) -- Fixed some bugs in the new streaming parsing APIs. - (https://github.com/sourcegraph/scip/pull/176, - https://github.com/sourcegraph/scip/pull/177) - -Rust bindings: - -- Added missing validation for local symbols when - parsing a symbol string. - (https://github.com/sourcegraph/scip/pull/206) - -## v0.3.0 - -SCIP schema: - -- Several new fields were added: - [`SymbolInformation.signature_documentation`](https://github.com/sourcegraph/scip/pull/159), - [`SymbolInformation.display_name`](https://github.com/sourcegraph/scip/pull/158), - [`SymbolInformation.kind`](https://github.com/sourcegraph/scip/pull/156) - [`Occurrence.enclosing_range`](https://github.com/sourcegraph/scip/pull/150) - -scip CLI: - -- The `print` subcommand supports a new `--json` flag to emit JSON output - instead of colored textual output. (https://github.com/sourcegraph/scip/pull/147) -- The `snapshot` subcommand supports a new `--comment-syntax` flag - to customize the prefix used for inline comments in snapshot output. - (https://github.com/sourcegraph/scip/pull/139) -- `snapshot` output now include override_documentation for occurrences. - (https://github.com/sourcegraph/scip/pull/116) - -Go bindings: - -- Added new APIs to parse SCIP indexes in a streaming - fashion at Document granularity. This allows consumers - to process SCIP indexes with better control over memory usage. - (https://github.com/sourcegraph/scip/pull/172) -- Fixed a panic when descriptors are incomplete - (https://github.com/sourcegraph/scip/pull/171) - -Rust bindings: - -- Fixes a bug when emitting symbols which require escaping - (https://github.com/sourcegraph/scip/pull/169) -- Fixes a bug in handling for macro symbols - (https://github.com/sourcegraph/scip/pull/145) - -## v0.2.3 - -### Fixes - -- Fixed a bug in SCIP to LSIF conversion of indexes using the new `Relationship.is_definition` field. Without this fix, the generated LSIF index would fail to process in Sourcegraph with a "unknown reference to $ID (expected a range)" error. (https://github.com/sourcegraph/scip/pull/108) - -## v0.2.2 - -### Additions - -- The new `scip print` subcommand can be used to view a SCIP index without access to protoc. (https://github.com/sourcegraph/scip/pull/91) -- The new `scip lint` subcommand can be used to identify correctness and redundancy issues with a SCIP index. (https://github.com/sourcegraph/scip/pull/92) - -### Fixes - -- `scip --version` now works as expected instead of reporting 0.1.0. (https://github.com/sourcegraph/scip/pull/97) diff --git a/docs/Development.md b/docs/Development.md index ceb469d9..042e9b3d 100644 --- a/docs/Development.md +++ b/docs/Development.md @@ -80,13 +80,13 @@ go test ./cmd/scip -update-snapshots ## Release a new version -First, add release notes to the [CHANGELOG](../CHANGELOG.md). Next, update the -version in `cmd/scip/version.txt`, `bindings/rust/Cargo.toml`, -`bindings/rust/Cargo.lock`, and `docs/CLI.md` +Update the version in `cmd/scip/version.txt`, `bindings/rust/Cargo.toml`, +`bindings/rust/Cargo.lock`, and `docs/CLI.md`, then land a commit with those +changes. -After landing a commit with those two changes, trigger the +After the commit is on `main`, trigger the [release workflow](/.github/workflows/release.yml) from the Actions tab on GitHub, providing the version number (e.g. `0.7.0`). -The workflow will validate the CHANGELOG and version.txt, create and push -tags, create the GitHub release, publish the Rust crate, and build and -upload CLI binaries. +The workflow will validate version.txt, create and push tags, create a draft +GitHub release (with auto-generated notes), publish the Rust crate, build and +upload CLI binaries, and finally mark the release as non-draft.