Skip to content

Commit

Permalink
[release-v0.42] extension/tools/release: skip version check in releas…
Browse files Browse the repository at this point in the history
…e process

Both package creation and package publish will skip the version check.

For #3500

Change-Id: I530f600bb983ac1e9e884bc6910bcd8f1b0717e0
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/612815
Commit-Queue: Hongxiang Jiang <[email protected]>
kokoro-CI: kokoro <[email protected]>
Auto-Submit: Hongxiang Jiang <[email protected]>
Reviewed-by: Hyang-Ah Hana Kim <[email protected]>
(cherry picked from commit 97292e3)
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/611845
  • Loading branch information
h9jiang authored and gopherbot committed Sep 13, 2024
1 parent ed829be commit c939531
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 21 deletions.
19 changes: 2 additions & 17 deletions extension/tools/release/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
package main

import (
"bytes"
"flag"
"fmt"
"os"
Expand All @@ -46,16 +45,17 @@ func main() {
cmd := flag.Arg(0)

checkWD()
requireTools("jq", "npx", "gh", "git")
requireEnvVars("TAG_NAME")

tagName, version, isRC := releaseVersionInfo()
vsix := fmt.Sprintf("go-%s.vsix", version)

switch cmd {
case "package":
requireTools("npx")
buildPackage(version, tagName, vsix)
case "publish":
requireTools("npx", "gh", "git")
requireEnvVars("VSCE_PAT", "GITHUB_TOKEN")
publish(tagName, vsix, isRC)
default:
Expand Down Expand Up @@ -129,21 +129,6 @@ func releaseVersionInfo() (tagName, version string, isPrerelease bool) {
}
isPrerelease = true
}

cmd := exec.Command("jq", "-r", ".version", "package.json")
cmd.Stderr = os.Stderr
var buf bytes.Buffer
cmd.Stdout = &buf
if err := commandRun(cmd); err != nil {
fatalf("failed to read package.json version")
}
versionInPackageJSON := buf.Bytes()
if *flagN {
return tagName, mmp + label, isPrerelease
}
if got := string(bytes.TrimSpace(versionInPackageJSON)); got != mmp {
fatalf("package.json version %q does not match TAG_NAME %q", got, tagName)
}
return tagName, mmp + label, isPrerelease
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
jq -r .version package.json
cp ../README.md README.md
npx vsce package -o go-0.0.0-rc.1.vsix --baseContentUrl https://github.com/golang/vscode-go/raw/v0.0.0-rc.1 --baseImagesUrl https://github.com/golang/vscode-go/raw/v0.0.0-rc.1 --no-update-package-json --no-git-tag-version 0.0.0-rc.1
1 change: 0 additions & 1 deletion extension/tools/release/testdata/package-v0.0.0.golden
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
jq -r .version package.json
cp ../README.md README.md
npx vsce package -o go-0.0.0.vsix --baseContentUrl https://github.com/golang/vscode-go/raw/v0.0.0 --baseImagesUrl https://github.com/golang/vscode-go/raw/v0.0.0 --no-update-package-json --no-git-tag-version 0.0.0
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
jq -r .version package.json
stat go-0.0.0-rc.1.vsix
release create --generate-notes --target 4893cd984d190bdf2cd65e11c425b42819ae6f57 --title Release v0.0.0-rc.1 --draft
gh release create --generate-notes --target 4893cd984d190bdf2cd65e11c425b42819ae6f57 --title Release v0.0.0-rc.1 --draft --prerelease -R github.com/golang/vscode-go v0.0.0-rc.1 go-0.0.0-rc.1.vsix
1 change: 0 additions & 1 deletion extension/tools/release/testdata/publish-v0.0.0.golden
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
jq -r .version package.json
stat go-0.0.0.vsix
release create --generate-notes --target 4893cd984d190bdf2cd65e11c425b42819ae6f57 --title Release v0.0.0 --draft
gh release create --generate-notes --target 4893cd984d190bdf2cd65e11c425b42819ae6f57 --title Release v0.0.0 --draft -R github.com/golang/vscode-go v0.0.0 go-0.0.0.vsix
Expand Down

0 comments on commit c939531

Please sign in to comment.