|
1 |
| -name: release |
| 1 | +name: Release (golang.go) |
2 | 2 |
|
3 |
| -# Daily release on 15:00 UTC, monday-thursday. |
4 |
| -# Or, force to release by triggering repository_dispatch events by using |
5 |
| -# 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" }' |
6 |
| -on: |
7 |
| - schedule: |
8 |
| - - cron: "0 15 * * MON-THU" # 15 UTC, monday-thursday daily |
9 |
| - repository_dispatch: |
10 |
| - types: [force-release] |
| 3 | +# The new release workflow is triggered when a new tag on the release |
| 4 | +# branch is pushed. |
| 5 | +# |
| 6 | +# Note: our canonical repository is in go.googlesource.com/vscode-go and tagging |
| 7 | +# will be done in the canonical repository, and mirrored to the github repository. |
| 8 | +# A typical workflow is: |
| 9 | +# |
| 10 | +# 1. A human operator creates a CL to merge the main dev branch to the 'release' branch. |
| 11 | +# CI (GCB builder) will test the CL. |
| 12 | +# 2. The CL is reviewed and merged. This triggers the "Long test workflow" (test-long.yml). |
| 13 | +# 3. The human operator verifies the "Long test workflow" is green. |
| 14 | +# Otherwise, fix (fix, cherry-pick, review, commit) on the 'release' branch. |
| 15 | +# 4. When the 'release' branch reaches to the state ready for the release, |
| 16 | +# the human operator will tag the commig from the canonical repository. |
| 17 | +# (https://go-review.googlesource.com/admin/repos/vscode-go,tags) |
| 18 | +# Stable versions should be in the format of 'vX.X.X' (e.g. v0.15.0) |
| 19 | +# Release candidates should be in the format of 'vX.X.X-rc.X' (e.g. v0.15.0-rc.1) |
| 20 | +# 5. The gopherbot will mirror the tag to the GitHub repo, and that push will trigger |
| 21 | +# the 'Release (golang.go)' workflow specified in this file. |
| 22 | +# - For stable version release (vX.X.X), check if the package.json has the matching version. |
| 23 | +# - Packaging using 'vsce package' |
| 24 | +# - Create a release in Github |
| 25 | +# - Upload the vsix file as an asset of the release |
| 26 | +# - For stable version release (vX.X.X), upload to the vscode market place |
| 27 | +# (not implemented in this CL) |
11 | 28 |
|
12 |
| -env: |
13 |
| - GOPATH: /tmp/go |
14 |
| - # Because some tests require explicit setting of GOPATH. TODO: FIX THEM. |
| 29 | +on: |
| 30 | + push: |
| 31 | + tags: |
| 32 | + - v* |
15 | 33 |
|
16 | 34 | jobs:
|
17 |
| - release: |
18 |
| - name: Release Nightly |
| 35 | + build: |
| 36 | + name: create release |
19 | 37 | runs-on: ubuntu-latest
|
20 |
| - timeout-minutes: 20 |
21 | 38 |
|
22 | 39 | steps:
|
23 |
| - - name: Clone repository |
24 |
| - uses: actions/checkout@v1 |
| 40 | + - name: checkout code |
| 41 | + uses: actions/checkout@v2 |
25 | 42 |
|
26 |
| - - name: Setup Node |
27 |
| - uses: actions/setup-node@v1 |
28 |
| - with: |
29 |
| - node-version: '10.x' |
| 43 | + - name: get release version |
| 44 | + id: release_version |
| 45 | + run: | |
| 46 | + TAGGED_VERSION="${GITHUB_REF/refs\/tags\/v/}" |
30 | 47 |
|
31 |
| - - name: Setup Go |
32 |
| - uses: actions/setup-go@v1 |
33 |
| - with: |
34 |
| - go-version: '1.14' |
| 48 | + if [[ ! "${TAGGED_VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then |
| 49 | + echo "Invalid version tag '${TAGGED_VERSION}'" |
| 50 | + exit 1 |
| 51 | + fi |
35 | 52 |
|
36 |
| - - name: Install dependencies |
37 |
| - run: npm install |
| 53 | + echo ::set-env name=EXT_VERSION::"${TAGGED_VERSION}" |
| 54 | + WRITTEN_VERSION="$(cat package.json | jq '.version' -r)" |
38 | 55 |
|
39 |
| - - name: Install Go tools (Modules mode) |
40 |
| - run: | |
41 |
| - go version |
42 |
| - go get github.com/acroca/go-symbols \ |
43 |
| - github.com/davidrjenni/reftools/cmd/fillstruct \ |
44 |
| - github.com/haya14busa/goplay/cmd/goplay \ |
45 |
| - github.com/mdempsky/gocode \ |
46 |
| - github.com/sqs/goreturns \ |
47 |
| - github.com/uudashr/gopkgs/v2/cmd/gopkgs \ |
48 |
| - github.com/zmb3/gogetdoc \ |
49 |
| - golang.org/x/lint/golint \ |
50 |
| - golang.org/x/tools/cmd/gorename |
51 |
| - env: |
52 |
| - GO111MODULE: on |
| 56 | + if [[ ${TAGGED_VERSION} == *"-"* ]]; then |
| 57 | + echo ::set-env name=EXT_ISPREVIEW::1 |
| 58 | + else |
| 59 | + if [[ "${TAGGED_VERSION}" != "${WRITTEN_VERSION}" ]]; then |
| 60 | + echo "Release Tag and Version in package.json do not match: '${TAGGED_VERSION}' vs '${WRITTEN_VERSION}'" |
| 61 | + exit 1 |
| 62 | + fi |
| 63 | + echo ::set-env name=EXT_ISPREVIEW::0 |
| 64 | + fi |
53 | 65 |
|
54 |
| - - name: Install Go tools (GOPATH mode) |
| 66 | + - name: stamp version |
55 | 67 | run: |
|
56 |
| - go version |
57 |
| - go get github.com/cweill/gotests/... \ |
58 |
| - github.com/rogpeppe/godef \ |
59 |
| - github.com/ramya-rao-a/go-outline |
60 |
| - # Because some tests depend on the source code checked in GOPATH. TODO: FIX THEM. |
61 |
| - env: |
62 |
| - GO111MODULE: off |
| 68 | + cat package.json | jq --arg VER "${{ env.EXT_VERSION }}" '.version=$VER' > /tmp/package.json |
| 69 | + cp /tmp/package.json ./package.json |
| 70 | + npm ci |
| 71 | + npm run vscode:prepublish |
63 | 72 |
|
64 |
| - - name: Prepare Release |
65 |
| - run: build/all.bash prepare_nightly |
66 |
| - |
67 |
| - - name: Run unit tests |
68 |
| - run: npm run unit-test |
69 |
| - continue-on-error: true |
70 |
| - |
71 |
| - - name: Run tests |
72 |
| - |
| 73 | + - name: package |
| 74 | + uses: lannonbr/vsce-action@704da577da0f27de5cdb4ae018374c2f08b5f523 |
73 | 75 | with:
|
74 |
| - run: npm run test |
75 |
| - env: |
76 |
| - CODE_VERSION: 'insiders' |
| 76 | + args: "package" |
77 | 77 |
|
78 |
| - - name: Publish |
79 |
| - if: github.ref == 'refs/heads/master' && github.repository == 'golang/vscode-go' |
80 |
| - uses: lannonbr/vsce-action@704da577da0f27de5cdb4ae018374c2f08b5f523 |
| 78 | + - name: create release |
| 79 | + id: create_release |
| 80 | + uses: actions/create-release@v1 |
| 81 | + env: |
| 82 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
81 | 83 | with:
|
82 |
| - args: "publish -p $VSCE_TOKEN" |
| 84 | + tag_name: ${{ github.ref }} |
| 85 | + release_name: Release ${{ env.EXT_VERSION }} |
| 86 | + draft: false |
| 87 | + prerelease: ${{env.EXT_ISPREVIEW == 1}} |
| 88 | + |
| 89 | + - name: upload release asset |
| 90 | + uses: actions/upload-release-asset@v1 |
83 | 91 | env:
|
84 |
| - VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }} |
| 92 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 93 | + with: |
| 94 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 95 | + asset_path: ./go-${{ env.EXT_VERSION }}.vsix |
| 96 | + asset_name: go-${{ env.EXT_VERSION }}.vsix |
| 97 | + asset_content_type: application/zip |
| 98 | +# TODO: check if the commit is in green state. (test-long.yml results) |
| 99 | +# TODO: publish to the market if VERSION is for a stable version. |
| 100 | +# TODO: after publishing, create a gerrit CL to update 'latest' branch if VERSION is for a stable version. |
0 commit comments