.github/workflows: adjust release nightly to use npx vsce

We can use the installed vsce instead of the third-party action.
We also adjust the nightly workflow to package vsix in clean state
before running any tests. That will reduce the chance of including
unwanted files generated during tests.

Updates golang/vscode-go#2676

Change-Id: I246cd1bf99bc51e23575ef16630e8eead04b11e2
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/470195
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
(cherry picked from commit 179f226cc7fbba405a861a3a69600865f65ca21c)
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/470637
Run-TryBot: Suzy Mueller <suzmue@golang.org>
Auto-Submit: Suzy Mueller <suzmue@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
diff --git a/.github/workflows/release-nightly.yml b/.github/workflows/release-nightly.yml
index d8e92f7..3ec8393 100644
--- a/.github/workflows/release-nightly.yml
+++ b/.github/workflows/release-nightly.yml
@@ -39,6 +39,13 @@
       - name: Prepare Release
         run: build/all.bash prepare_nightly
 
+      - name: Version
+        run: |
+          echo "VSCODE_GO_VERSION=$(jq .version package.json | tr -d '"')" >> $GITHUB_ENV
+
+      - name: Package Extension
+        run: npx vsce package -o "./go-nightly-${{ env.VSCODE_GO_VERSION }}.vsix"
+
       - name: Compile
         run: npm run vscode:prepublish
 
@@ -62,8 +69,7 @@
 
       - name: Publish
         if: github.ref == 'refs/heads/master' && github.repository == 'golang/vscode-go'
-        uses: lannonbr/vsce-action@0f3391ee0477b08fae949eb0a875e91e6d20b075
-        with:
-          args: "publish -p $VSCE_TOKEN"
-        env:
-          VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }}
+        run: |
+          echo "publishing ${{ env.VSCODE_GO_VERSION }}"
+          ls *.vsix
+          npx vsce publish -i "./go-nightly-${{ env.VSCODE_GO_VERSION }}.vsix" -p "${{ secrets.VSCE_TOKEN }}"
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 342a43f..75623a6 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -108,10 +108,6 @@
 
       - name: publish
         if: env.EXT_ISPREVIEW != 1 && github.repository == 'golang/vscode-go'
-        uses: lannonbr/vsce-action@0f3391ee0477b08fae949eb0a875e91e6d20b075
-        with:
-          args: "publish -p $VSCE_TOKEN"
-        env:
-          VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }}
+        run: npx vsce publish -i "./go-nightly-${{ env.VSCODE_GO_VERSION }}.vsix" -p "${{ secrets.VSCE_TOKEN }}"
 
 # TODO: check if the commit is in green state. (test-long.yml results)