From be6b7cd15c7c99ac26388b2a5d6f6244c04e5343 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 10 Nov 2026 12:51:39 +0000 Subject: [PATCH 1/4] release 5.2.0 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_018s9fHcEQxmXZ7pQ6v9W2KM --- CHANGELOG.md | 2 ++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46d24cb..9c68b7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## 5.2.0 - 2026-11-10 + ### Added - Add `githubCodeOwners.format.align` and `githubCodeOwners.format.spacing`. Set them to `file` and `5` to format like before 5.1.0 (#44). diff --git a/package-lock.json b/package-lock.json index 49d0187..5a6347a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "github-code-owners", - "version": "5.1.0", + "version": "5.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "github-code-owners", - "version": "5.1.0", + "version": "5.2.0", "license": "SEE LICENSE IN LICENSE", "dependencies": { "@snyk/github-codeowners": "github:chdsbd/github-codeowners#bb24c2adb022a88e03f25a3680a23934a281a5c3", diff --git a/package.json b/package.json index 9899501..e53dd87 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Quickly see GitHub Code Owners for the current file. Add syntax highlighting for CODEOWNERS files.", "publisher": "chdsbd", "license": "SEE LICENSE IN LICENSE", - "version": "5.1.0", + "version": "5.2.0", "icon": "images/logo256.png", "homepage": "https://github.com/chdsbd/vscode-github-code-owners/blob/master/README.md", "keywords": [ From a8413c828c58e96dba3a17360eb07e20857a098b Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 10 Nov 2026 12:55:25 +0000 Subject: [PATCH 2/4] Draft a release when master has a new version The draft's notes are the version's CHANGELOG.md section. Publishing it creates the tag and runs publish.yml. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_018s9fHcEQxmXZ7pQ6v9W2KM --- .github/workflows/draft-release.yml | 34 +++++++++++++++++++++++++++++ s/release-notes | 22 +++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 .github/workflows/draft-release.yml create mode 100755 s/release-notes diff --git a/.github/workflows/draft-release.yml b/.github/workflows/draft-release.yml new file mode 100644 index 0000000..0d9c1cb --- /dev/null +++ b/.github/workflows/draft-release.yml @@ -0,0 +1,34 @@ +name: Draft release + +# When master has a version with no release yet, draft one with its +# CHANGELOG.md section. Publishing the draft creates the tag, which runs +# publish.yml. +on: + push: + branches: + - "master" + +permissions: {} + +jobs: + draft: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - name: Draft a release for a new version + run: | + tag="v$(node -p "require('./package.json').version")" + # Drafts have their tag name before the tag exists. + if gh api "repos/$GH_REPO/releases" --paginate --jq '.[].tag_name' | grep -qxF "$tag"; then + echo "$tag already has a release" + exit 0 + fi + ./s/release-notes "${tag#v}" > notes.md + gh release create "$tag" --draft --target "$GITHUB_SHA" --title "$tag" --notes-file notes.md + env: + GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} diff --git a/s/release-notes b/s/release-notes new file mode 100755 index 0000000..9c3d826 --- /dev/null +++ b/s/release-notes @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# s/release-notes +# +# Print the CHANGELOG.md section for a version, like 5.2.0, without its +# heading, for the release's notes. Errors if there's no section for it. +set -euo pipefail + +version=$1 + +cd "$(dirname "$0")/.." +notes=$(awk -v heading="## $version " ' + index($0, heading) == 1 { found = 1; next } + found && /^## / { exit } + found { print } +' CHANGELOG.md) +# Without the blank lines around it. +notes=$(printf '%s\n' "$notes" | sed -e '/./,$!d') +if [[ -z "$notes" ]]; then + echo "No section for $version in CHANGELOG.md" >&2 + exit 1 +fi +printf '%s\n' "$notes" From 1567ded0d81d31741d2c753dcbc7d9038292614e Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 10 Nov 2026 13:20:06 +0000 Subject: [PATCH 3/4] Match gh-codeowners' release drafting Use its s/release-notes, skip versions that already have a tag, don't let two pushes draft at once, and document releasing in CONTRIBUTING.md. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_018s9fHcEQxmXZ7pQ6v9W2KM --- .github/workflows/draft-release.yml | 23 ++++++++++++++-------- CONTRIBUTING.md | 7 +++++++ s/release-notes | 30 ++++++++++++++++------------- 3 files changed, 39 insertions(+), 21 deletions(-) create mode 100644 CONTRIBUTING.md diff --git a/.github/workflows/draft-release.yml b/.github/workflows/draft-release.yml index 0d9c1cb..e447961 100644 --- a/.github/workflows/draft-release.yml +++ b/.github/workflows/draft-release.yml @@ -1,8 +1,8 @@ name: Draft release -# When master has a version with no release yet, draft one with its -# CHANGELOG.md section. Publishing the draft creates the tag, which runs -# publish.yml. +# Pushing a version to master that has no release yet drafts one with the +# version's CHANGELOG.md section. Publishing the draft creates the tag, which +# runs publish.yml. on: push: branches: @@ -10,6 +10,11 @@ on: permissions: {} +# Two quick pushes shouldn't both see the version as unreleased. +concurrency: + group: draft-release + cancel-in-progress: false + jobs: draft: runs-on: ubuntu-latest @@ -23,12 +28,14 @@ jobs: run: | tag="v$(node -p "require('./package.json').version")" # Drafts have their tag name before the tag exists. - if gh api "repos/$GH_REPO/releases" --paginate --jq '.[].tag_name' | grep -qxF "$tag"; then - echo "$tag already has a release" - exit 0 + if gh api "repos/$GH_REPO/git/ref/tags/$tag" --silent 2>/dev/null; then + echo "$tag already exists" + elif gh api "repos/$GH_REPO/releases" --paginate --jq '.[].tag_name' | grep -qxF "$tag"; then + echo "$tag already has a draft release" + else + s/release-notes "$tag" > notes.md + gh release create "$tag" --draft --target "$GITHUB_SHA" --notes-file notes.md --title "$tag" fi - ./s/release-notes "${tag#v}" > notes.md - gh release create "$tag" --draft --target "$GITHUB_SHA" --title "$tag" --notes-file notes.md env: GH_TOKEN: ${{ github.token }} GH_REPO: ${{ github.repository }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..c8d0bdb --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,7 @@ +# CONTRIBUTING + +## Releasing + +1. Bump the version in `package.json` and update `CHANGELOG.md`. +2. Merge your PR and GitHub Actions will create a draft release. +3. Publish the draft release. GitHub Actions publishes the extension to the Marketplace. diff --git a/s/release-notes b/s/release-notes index 9c3d826..d6c1e28 100755 --- a/s/release-notes +++ b/s/release-notes @@ -1,22 +1,26 @@ #!/usr/bin/env bash -# s/release-notes +# s/release-notes VERSION # -# Print the CHANGELOG.md section for a version, like 5.2.0, without its -# heading, for the release's notes. Errors if there's no section for it. +# Prints the CHANGELOG.md section for VERSION, for the GitHub release notes. set -euo pipefail -version=$1 - cd "$(dirname "$0")/.." -notes=$(awk -v heading="## $version " ' - index($0, heading) == 1 { found = 1; next } - found && /^## / { exit } - found { print } -' CHANGELOG.md) -# Without the blank lines around it. -notes=$(printf '%s\n' "$notes" | sed -e '/./,$!d') + +version=${1#v} + +notes=$(awk -v version="$version" ' + /^## / { + if (found) exit + heading = $2 + sub(/^v/, "", heading) + found = heading == version + next + } + found +' CHANGELOG.md | sed -e '/./,$!d') + if [[ -z "$notes" ]]; then - echo "No section for $version in CHANGELOG.md" >&2 + echo "❌ no CHANGELOG.md section for $version" >&2 exit 1 fi printf '%s\n' "$notes" From 8c28709e090c313b7f1fda1894d05ddb6884e3dc Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 10 Nov 2026 13:30:05 +0000 Subject: [PATCH 4/4] Attach every platform's package to the draft, and publish those draft-release.yml builds a VSIX package for each platform and only drafts the release once s/check-packages finds all of them attached, deleting a draft that's missing any. publish.yml publishes the release's packages to the Marketplace, after checking they're all there. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_018s9fHcEQxmXZ7pQ6v9W2KM --- .github/workflows/draft-release.yml | 75 ++++++++++++++++++++++++++--- .github/workflows/publish.yml | 36 +++----------- CONTRIBUTING.md | 4 +- README.md | 2 +- s/check-packages | 22 +++++++++ s/package-all | 31 ++++++++++++ s/packages | 14 ++++++ 7 files changed, 146 insertions(+), 38 deletions(-) create mode 100755 s/check-packages create mode 100755 s/package-all create mode 100755 s/packages diff --git a/.github/workflows/draft-release.yml b/.github/workflows/draft-release.yml index e447961..f067e32 100644 --- a/.github/workflows/draft-release.yml +++ b/.github/workflows/draft-release.yml @@ -1,8 +1,10 @@ name: Draft release -# Pushing a version to master that has no release yet drafts one with the -# version's CHANGELOG.md section. Publishing the draft creates the tag, which -# runs publish.yml. +# Pushing a version to master that has no release yet builds a VSIX package +# for each platform, then drafts a release with them and the version's +# CHANGELOG.md section. The draft only appears with every package attached. +# Publishing it creates the tag and runs publish.yml, which publishes the +# draft's packages to the Marketplace. on: push: branches: @@ -16,15 +18,18 @@ concurrency: cancel-in-progress: false jobs: - draft: + version: runs-on: ubuntu-latest permissions: + # Only tokens that can push see draft releases. contents: write + outputs: + tag: ${{ steps.version.outputs.tag }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - - name: Draft a release for a new version + - id: version run: | tag="v$(node -p "require('./package.json').version")" # Drafts have their tag name before the tag exists. @@ -33,9 +38,65 @@ jobs: elif gh api "repos/$GH_REPO/releases" --paginate --jq '.[].tag_name' | grep -qxF "$tag"; then echo "$tag already has a draft release" else - s/release-notes "$tag" > notes.md - gh release create "$tag" --draft --target "$GITHUB_SHA" --notes-file notes.md --title "$tag" + echo "tag=$tag" >> "$GITHUB_OUTPUT" + fi + env: + GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} + # Separate from drafting, so npm ci runs without write access. + build: + needs: version + if: needs.version.outputs.tag + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version-file: "package.json" + package-manager-cache: false + - run: npm ci + - run: s/package-all "$TAG" dist + env: + TAG: ${{ needs.version.outputs.tag }} + GH_TOKEN: ${{ github.token }} + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: packages + path: dist/*.vsix + if-no-files-found: error + draft: + needs: [version, build] + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: packages + path: dist + - run: | + s/check-packages "$TAG" dist/*.vsix + s/release-notes "$TAG" > notes.md + assets() { + gh api "repos/$GH_REPO/releases" --paginate \ + --jq ".[] | select(.draft and .tag_name == \"$TAG\") | .$1" + } + # A draft missing a package would block the next run, so delete it. + if ! gh release create "$TAG" --draft --target "$GITHUB_SHA" --notes-file notes.md --title "$TAG" dist/*.vsix || + ! s/check-packages "$TAG" $(assets 'assets[].name'); then + for id in $(assets id); do + gh api -X DELETE "repos/$GH_REPO/releases/$id" + done + exit 1 fi env: + TAG: ${{ needs.version.outputs.tag }} GH_TOKEN: ${{ github.token }} GH_REPO: ${{ github.repository }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a15bc47..3cb53c1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,5 +1,6 @@ name: Publish +# Publishes the packages draft-release.yml attached to the release. on: release: types: [published] @@ -7,24 +8,8 @@ on: permissions: {} jobs: - # A build for each platform bundles gh-codeowners as the language server. - # The universal build has no binary, for other platforms, and falls back to - # the built-in features. publish: if: ${{ !github.event.release.prerelease }} - strategy: - fail-fast: false - matrix: - target: - - darwin-arm64 - - darwin-x64 - - linux-x64 - - linux-arm64 - - alpine-x64 - - alpine-arm64 - - win32-x64 - - win32-arm64 - - universal runs-on: ubuntu-latest environment: marketplace permissions: @@ -44,18 +29,13 @@ jobs: run: test "$GITHUB_REF_NAME" = "v$(node -p "require('./package.json').version")" - name: Install dependencies run: npm ci - - name: Download gh-codeowners - if: matrix.target != 'universal' - run: ./s/download-server "$TARGET" + # Publish nothing unless every package is there. + - name: Download the release's packages + run: | + gh release download "$GITHUB_REF_NAME" --pattern "*.vsix" --dir dist + s/check-packages "$GITHUB_REF_NAME" dist/*.vsix env: - TARGET: ${{ matrix.target }} GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} - name: Publish to Visual Studio Marketplace - run: | - if [[ "$TARGET" == universal ]]; then - npx --no-install vsce publish --oidc - else - npx --no-install vsce publish --oidc --target "$TARGET" - fi - env: - TARGET: ${{ matrix.target }} + run: npx --no-install vsce publish --oidc --packagePath dist/*.vsix diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c8d0bdb..bafe2a1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,5 +3,5 @@ ## Releasing 1. Bump the version in `package.json` and update `CHANGELOG.md`. -2. Merge your PR and GitHub Actions will create a draft release. -3. Publish the draft release. GitHub Actions publishes the extension to the Marketplace. +2. Merge your PR and GitHub Actions will build a package for each platform and create a draft release with them. +3. Publish the draft release. GitHub Actions publishes its packages to the Marketplace. diff --git a/README.md b/README.md index 503a274..4f9ecaa 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ In VSCode, type `CMD`+`P` and enter `ext install chdsbd.github-code-owners`. Or ### From Github release -Download the extension package from the [latest Github release](https://github.com/chdsbd/vscode-github-code-owners/releases/latest) and run `code --install-extension github-code-owners-*.vsix` +Download the extension package for your platform from the [latest Github release](https://github.com/chdsbd/vscode-github-code-owners/releases/latest), like `github-code-owners-5.3.0-darwin-arm64.vsix`, and run `code --install-extension github-code-owners-5.3.0-darwin-arm64.vsix` ### From source diff --git a/s/check-packages b/s/check-packages new file mode 100755 index 0000000..e374abb --- /dev/null +++ b/s/check-packages @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# s/check-packages VERSION FILE... +# +# Errors unless FILE... are exactly the VSIX packages s/packages lists for +# VERSION. Only file names are compared, so FILE can be a path or a release +# asset name. +set -euo pipefail + +cd "$(dirname "$0")/.." + +version=$1 +shift + +expected=$(s/packages "$version" | cut -d' ' -f2 | sort) +actual=$(for file in "$@"; do basename "$file"; done | sort) + +if [[ "$expected" != "$actual" ]]; then + echo "❌ packages don't match s/packages for $version" >&2 + diff <(echo "$expected") <(echo "$actual") >&2 || true + exit 1 +fi +echo "✅ all $(echo "$expected" | wc -l | tr -d ' ') packages" diff --git a/s/package-all b/s/package-all new file mode 100755 index 0000000..d08aa53 --- /dev/null +++ b/s/package-all @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +# s/package-all VERSION DIR +# +# Builds every VSIX package s/packages lists for VERSION into DIR, each +# bundling its platform's gh-codeowners binary. +set -euo pipefail + +cd "$(dirname "$0")/.." + +version=${1#v} +dir=$2 + +if [[ "$version" != "$(node -p "require('./package.json').version")" ]]; then + echo "❌ $version isn't the version in package.json" >&2 + exit 1 +fi + +mkdir -p "$dir" +# Its own file descriptor, so commands in the loop can't read the list. +while read -r target file <&3; do + if [[ "$target" == universal ]]; then + rm -rf bin + npx --no-install vsce package --out "$dir/$file" + else + s/download-server "$target" + npx --no-install vsce package --target "$target" --out "$dir/$file" + fi +done 3< <(s/packages "$version") +rm -rf bin + +s/check-packages "$version" "$dir"/*.vsix diff --git a/s/packages b/s/packages new file mode 100755 index 0000000..67c11f4 --- /dev/null +++ b/s/packages @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +# s/packages VERSION +# +# Prints each VSIX package a release needs, as " ". +# Each platform's package bundles gh-codeowners as the language server. The +# universal package has no binary, for other platforms, and falls back to the +# built-in features. +set -euo pipefail + +version=${1#v} + +for target in darwin-arm64 darwin-x64 linux-x64 linux-arm64 alpine-x64 alpine-arm64 win32-x64 win32-arm64 universal; do + echo "$target github-code-owners-$version-$target.vsix" +done