@@ -81,54 +81,95 @@ jobs:
8181 package :
8282 needs : test
8383 runs-on : ubuntu-18.04
84-
85- steps :
86- - uses : actions/checkout@v2.3.4
87-
88- - name : Use Node.js
89- uses : actions/setup-node@v2.1.5
90- with :
91- node-version : 14.4.0
92-
93- - run : npm ci
94- - run : npm run compile
95-
96- - name : Download MacOS binary
97- uses : actions/download-artifact@v3.0.0
98- with :
99- name : macos-latest
100- path : ./server/analysis_binaries
101- - run : tar -xvf binary.tar
102- working-directory : ./server/analysis_binaries
103-
104- - name : Download Linux binary
105- uses : actions/download-artifact@v3.0.0
106- with :
107- name : ubuntu-18.04
108- path : ./server/analysis_binaries
109- - run : tar -xvf binary.tar
110- working-directory : ./server/analysis_binaries
11184
112- - name : Download Windows binary
113- uses : actions/download-artifact@v3.0.0
114- with :
115- name : windows-latest
116- path : ./server/analysis_binaries
117- - run : tar -xvf binary.tar
118- working-directory : ./server/analysis_binaries
119-
120- - name : Cleanup tar file
121- run : rm binary.tar
122- working-directory : ./server/analysis_binaries
123-
124- - name : Store short commit SHA for filename
125- id : vars
126- run : echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
127-
128- - name : Package Extension
129- run : npx vsce package -o rescript-vscode-${{ steps.vars.outputs.sha_short }}.vsix
130-
131- - uses : actions/upload-artifact@v2
132- with :
133- name : rescript-vscode-${{ steps.vars.outputs.sha_short }}.vsix
134- path : rescript-vscode-${{ steps.vars.outputs.sha_short }}.vsix
85+ steps :
86+ - uses : actions/checkout@v2.3.4
87+
88+ - name : Use Node.js
89+ uses : actions/setup-node@v2.1.5
90+ with :
91+ node-version : 14.4.0
92+
93+ - run : npm ci
94+ - run : npm run compile
95+
96+ - name : Download MacOS binary
97+ uses : actions/download-artifact@v3.0.0
98+ with :
99+ name : macos-latest
100+ path : ./server/analysis_binaries
101+ - run : tar -xvf binary.tar
102+ working-directory : ./server/analysis_binaries
103+
104+ - name : Download Linux binary
105+ uses : actions/download-artifact@v3.0.0
106+ with :
107+ name : ubuntu-18.04
108+ path : ./server/analysis_binaries
109+ - run : tar -xvf binary.tar
110+ working-directory : ./server/analysis_binaries
111+
112+ - name : Download Windows binary
113+ uses : actions/download-artifact@v3.0.0
114+ with :
115+ name : windows-latest
116+ path : ./server/analysis_binaries
117+ - run : tar -xvf binary.tar
118+ working-directory : ./server/analysis_binaries
119+
120+ - name : Cleanup tar file
121+ run : rm binary.tar
122+ working-directory : ./server/analysis_binaries
123+
124+ - name : Store short commit SHA for filename
125+ id : vars
126+ run : echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
127+
128+ - name : Get current pre-release version
129+ id : get_pre_release
130+ run : |
131+ JSON=$(npx vsce show chenglou92.rescript-vscode --json)
132+ VERSION=$(echo $JSON | jq '.versions | .[0] | .["version"]')
133+ echo "${VERSION}"
134+ echo "::set-output name=current_version::${VERSION}"
135+
136+ - name : Increment pre-release version
137+ id : increment_pre_release
138+ run : |
139+ NEW_VERSION=$(echo ${{ steps.get_pre_release.outputs.current_version }})
140+ node .github/workflows/bump-version.js ${NEW_VERSION}
141+ echo "${VERSION}"
142+
143+ - name : Package Extension
144+ if : github.ref != 'refs/heads/master'
145+ run : npx vsce package -o rescript-vscode-${{ steps.vars.outputs.sha_short }}.vsix
146+
147+ - name : Package Extension
148+ if : github.ref == 'refs/heads/master'
149+ run : npx vsce package -o rescript-vscode-${{ steps.increment_pre_release.outputs.new_version }}.vsix ${{ steps.increment_pre_release.outputs.new_version }} --no-git-tag-version
150+
151+ - uses : actions/upload-artifact@v2
152+ if : github.ref != 'refs/heads/master'
153+ with :
154+ name : rescript-vscode-${{ steps.vars.outputs.sha_short }}.vsix
155+ path : rescript-vscode-${{ steps.vars.outputs.sha_short }}.vsix
156+
157+ - uses : actions/upload-artifact@v2
158+ if : github.ref == 'refs/heads/master'
159+ with :
160+ name : rescript-vscode-${{ steps.increment_pre_release.outputs.new_version }}.vsix
161+ path : rescript-vscode-${{ steps.increment_pre_release.outputs.new_version }}.vsix
162+
163+ - name : Publish latest master to GitHub
164+ if : github.ref == 'refs/heads/master'
165+ uses : marvinpinto/action-automatic-releases@latest
166+ with :
167+ repo_token : " ${{ secrets.GITHUB_TOKEN }}"
168+ automatic_release_tag : " latest-master"
169+ prerelease : true
170+ title : " latest-master"
171+ files : rescript-vscode-${{ steps.increment_pre_release.outputs.new_version }}.vsix
172+
173+ - name : Publish extension as pre-release
174+ if : github.ref == 'refs/heads/master'
175+ run : npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --pre-release ${{ steps.increment_pre_release.outputs.new_version }} --no-git-tag-version
0 commit comments