@@ -81,18 +81,18 @@ jobs:
81
81
package :
82
82
needs : test
83
83
runs-on : ubuntu-18.04
84
-
84
+
85
85
steps :
86
86
- uses : actions/checkout@v2.3.4
87
-
87
+
88
88
- name : Use Node.js
89
89
uses : actions/setup-node@v2.1.5
90
90
with :
91
91
node-version : 14.4.0
92
92
93
93
- run : npm ci
94
94
- run : npm run compile
95
-
95
+
96
96
- name : Download MacOS binary
97
97
uses : actions/download-artifact@v3.0.0
98
98
with :
@@ -126,11 +126,52 @@ jobs:
126
126
env :
127
127
COMMIT_SHA : ${{ github.event.pull_request.head.sha || github.sha }}
128
128
run : echo "::set-output name=sha_short::${COMMIT_SHA:0:7}"
129
-
129
+
130
+ - name : Get current pre-release version
131
+ if : github.ref == 'refs/heads/master'
132
+ id : get_pre_release
133
+ run : |
134
+ JSON=$(npx vsce show chenglou92.rescript-vscode --json)
135
+ VERSION=$(echo $JSON | jq '.versions | .[0] | .["version"]')
136
+ echo "::set-output name=current_version::${VERSION}"
137
+
138
+ - name : Increment pre-release version
139
+ if : github.ref == 'refs/heads/master'
140
+ id : increment_pre_release
141
+ run : |
142
+ NEW_VERSION=$(echo ${{ steps.get_pre_release.outputs.current_version }})
143
+ node .github/workflows/bump-version.js ${NEW_VERSION}
144
+
130
145
- name : Package Extension
131
- run : npx vsce package -o rescript-vscode-${{ steps.vars.outputs.sha_short }}.vsix
132
-
146
+ if : github.ref != 'refs/heads/master'
147
+ run : npx vsce package -o rescript-vscode-${{ steps.vars.outputs.sha_short }}.vsix
148
+
149
+ - name : Package Extension
150
+ if : github.ref == 'refs/heads/master'
151
+ 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
152
+
133
153
- uses : actions/upload-artifact@v2
154
+ if : github.ref != 'refs/heads/master'
134
155
with :
135
156
name : rescript-vscode-${{ steps.vars.outputs.sha_short }}.vsix
136
157
path : rescript-vscode-${{ steps.vars.outputs.sha_short }}.vsix
158
+
159
+ - uses : actions/upload-artifact@v2
160
+ if : github.ref == 'refs/heads/master'
161
+ with :
162
+ name : rescript-vscode-${{ steps.increment_pre_release.outputs.new_version }}.vsix
163
+ path : rescript-vscode-${{ steps.increment_pre_release.outputs.new_version }}.vsix
164
+
165
+ - name : Publish latest master to GitHub
166
+ if : github.ref == 'refs/heads/master'
167
+ uses : marvinpinto/action-automatic-releases@latest
168
+ with :
169
+ repo_token : " ${{ secrets.GITHUB_TOKEN }}"
170
+ automatic_release_tag : " latest-master"
171
+ prerelease : true
172
+ title : " Latest master"
173
+ files : rescript-vscode-${{ steps.increment_pre_release.outputs.new_version }}.vsix
174
+
175
+ - name : Publish extension as pre-release
176
+ if : github.ref == 'refs/heads/master'
177
+ run : npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --pre-release ${{ steps.increment_pre_release.outputs.new_version }} --no-git-tag-version
0 commit comments