-
Notifications
You must be signed in to change notification settings - Fork 7
55 lines (47 loc) · 2 KB
/
create_release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Create GitHub Release for Extension Package
on:
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '20.x'
- name: Install dependencies
run: npm install
- name: Build VSIX Package
run: npx vsce package
- name: Create release
id: create_release
uses: actions/github-script@v6
with:
script: |
const packageVersion = require('./package.json').version;
const response = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: `v${packageVersion}`,
name: `Release ${packageVersion}`,
body: `Generating release for version ${packageVersion}`
});
return response.data.id;
- name: Attach VSIX package to release
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const packageJson = require('./package.json');
const packageName = packageJson.name;
const packageVersion = packageJson.version;
const vsixFilename = `${packageName}-${packageVersion}.vsix`;
await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: ${{ steps.create_release.outputs.result }},
name: vsixFilename,
data: fs.readFileSync(vsixFilename)
});