github/workflow: daily release workflow

Daily release workflow is triggered everyday between Mon-Thu, 15:00 UTC (11am EDT).
This prepares the version string through local modification on package.json
and runs the tests again before publishing. The newly released version has the
version string computed based on the last git commit's commit timestamp.
  <Year>.<Month>.<Day>-<Short Commit Hash>

That means, if there is no commit since the last release, the publishing step
will fail (because the MS VS Code extension market will detect the identical version).

Update golang/vscode-go#5

Change-Id: Ief59f5ed4e89eea66df3607f20263c3f6b75e716
GitHub-Last-Rev: b888148a09251f7012136653d7f705d5ef4d1fde
GitHub-Pull-Request: golang/vscode-go#10
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/223677
Reviewed-by: Tyler Bui-Palsulich <tbp@google.com>
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..809a829
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,84 @@
+name: release
+
+# Daily release on 15:00 UTC, monday-thursday.
+# Or, force to release by triggering repository_dispatch events by using
+#   curl -v -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${GITHUB_TOKEN}" https://api.github.com/repos/golang/vscode-go/dispatches -d '{ "event_type": "force-release" }'
+on:
+  schedule:
+    - cron: "0 15 * * MON-THU"  # 15 UTC, monday-thursday daily
+  repository_dispatch:
+    types: [force-release]
+
+env:
+  GOPATH: /tmp/go
+  # Because some tests require explicit setting of GOPATH. TODO: FIX THEM.
+
+jobs:
+  release:
+    name: Release Nightly
+    runs-on: ubuntu-latest
+    timeout-minutes: 20
+
+    steps:
+      - name: Clone repository
+        uses: actions/checkout@v1
+
+      - name: Setup Node
+        uses: actions/setup-node@v1
+        with:
+          node-version: '10.x'
+
+      - name: Setup Go
+        uses: actions/setup-go@v1
+        with:
+         go-version: '1.14'
+
+      - name: Install dependencies
+        run: npm ci
+
+      - name: Install Go tools (Modules mode)
+        run: |
+            go version
+            go get github.com/acroca/go-symbols \
+               github.com/davidrjenni/reftools/cmd/fillstruct \
+               github.com/haya14busa/goplay/cmd/goplay \
+               github.com/mdempsky/gocode \
+               github.com/sqs/goreturns \
+               github.com/uudashr/gopkgs/v2/cmd/gopkgs \
+               github.com/zmb3/gogetdoc \
+               golang.org/x/lint/golint \
+               golang.org/x/tools/cmd/gorename
+        env:
+          GO111MODULE: on
+
+      - name: Install Go tools (GOPATH mode)
+        run: |
+          go version
+          go get github.com/cweill/gotests/... \
+            github.com/rogpeppe/godef \
+            github.com/ramya-rao-a/go-outline
+            # Because some tests depend on the source code checked in GOPATH. TODO: FIX THEM.
+        env:
+          GO111MODULE: off
+
+      - name: Prepare Release
+        run: build/all.bash prepare_nightly
+
+      - name: Run unit tests
+        run: npm run unit-test
+        continue-on-error: true
+
+      - name: Run tests
+        uses: GabrielBB/xvfb-action@v1.0
+        with:
+          run: npm run test
+        env:
+          CODE_VERSION: 'insiders'
+
+      - name: Publish
+        if: github.ref == 'refs/heads/master' && github.repository == 'golang/vscode-go'
+        uses: lannonbr/vsce-action@704da577da0f27de5cdb4ae018374c2f08b5f523
+        with:
+          args: "publish -p $VSCE_TOKEN"
+        env:
+          VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }}
diff --git a/build/all.bash b/build/all.bash
index 1a8e4a8..f4e6593 100755
--- a/build/all.bash
+++ b/build/all.bash
@@ -51,6 +51,26 @@
   docker run --workdir=/workspace -v "$(pwd):/workspace" vscode-test-env ci
 }
 
+prepare_nightly() {
+  local VER=`git log -1 --format=%cd-%h --date="format:%Y.%-m.%-d"`
+  echo "**** Preparing nightly release : $VER ***"
+
+  # Update package.json
+  (cat package.json | jq --arg VER "${VER}" '
+.version=$VER |
+.preview=true |
+.name="go-nightly" |
+.displayName="Go Nightly" |
+.publisher="golang" |
+.description="Rich Go language support for Visual Studio Code (Nightly)" |
+.author.name="Go Team at Google" |
+.repository.url="https://github.com/golang/vscode-go" |
+.bugs.url="https://github.com/golang/vscode-go/issues"
+') > /tmp/package.json && mv /tmp/package.json package.json
+
+  # TODO(hyangah): Update README.md and CHANGELOG.md
+}
+
 main() {
   cd "$(root_dir)"  # always run from the script root.
   case "$1" in
@@ -70,9 +90,12 @@
       setup_virtual_display
       run_test
       ;;
+    "prepare_nightly")
+      prepare_nightly
+      ;;
     *)
       usage
       exit 2
   esac
 }
-main $@
\ No newline at end of file
+main $@
diff --git a/package.json b/package.json
index 26fa823..fac30ac 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
 {
   "name": "go-nightly",
   "displayName": "Go Nightly",
-  "version": "2020.3.144",
+  "version": "0.0.0-development",
   "publisher": "golang",
   "description": "Rich Go language support for Visual Studio Code (Nightly)",
   "author": {