@@ -148,3 +148,51 @@ jobs:
148
148
path : |
149
149
sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-${{ matrix.build }}-x64.zip
150
150
151
+ release :
152
+ if : ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
153
+
154
+ runs-on : ubuntu-latest
155
+
156
+ needs :
157
+ - ubuntu-latest-cmake
158
+ - macOS-latest-cmake
159
+ - windows-latest-cmake
160
+
161
+ steps :
162
+ - name : Download artifacts
163
+ id : download-artifact
164
+ uses : actions/download-artifact@v3
165
+
166
+ - name : Get commit hash
167
+ id : commit
168
+ uses : pr-mpt/actions-commit-hash@v2
169
+
170
+ - name : Create release
171
+ id : create_release
172
+ uses : anzz1/action-create-release@v1
173
+ env :
174
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
175
+ with :
176
+ tag_name : ${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}
177
+
178
+ - name : Upload release
179
+ id : upload_release
180
+ uses : actions/github-script@v3
181
+ with :
182
+ github-token : ${{secrets.GITHUB_TOKEN}}
183
+ script : |
184
+ const path = require('path');
185
+ const fs = require('fs');
186
+ const release_id = '${{ steps.create_release.outputs.id }}';
187
+ for (let file of await fs.readdirSync('./artifact')) {
188
+ if (path.extname(file) === '.zip') {
189
+ console.log('uploadReleaseAsset', file);
190
+ await github.repos.uploadReleaseAsset({
191
+ owner: context.repo.owner,
192
+ repo: context.repo.repo,
193
+ release_id: release_id,
194
+ name: file,
195
+ data: await fs.readFileSync(`./artifact/${file}`)
196
+ });
197
+ }
198
+ }
0 commit comments