@@ -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 :
@@ -124,11 +124,52 @@ jobs:
124
124
- name : Store short commit SHA for filename
125
125
id : vars
126
126
run : echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
127
-
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
+
128
143
- name : Package Extension
129
- run : npx vsce package -o rescript-vscode-${{ steps.vars.outputs.sha_short }}.vsix
130
-
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
+
131
151
- uses : actions/upload-artifact@v2
152
+ if : github.ref != 'refs/heads/master'
132
153
with :
133
154
name : rescript-vscode-${{ steps.vars.outputs.sha_short }}.vsix
134
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