1
1
name : Release
2
-
3
2
on :
4
3
push :
5
4
branches :
6
5
- main
7
-
8
6
jobs :
9
7
release :
10
8
runs-on : ubuntu-latest
11
-
12
9
steps :
13
10
- name : Checkout code
14
11
uses : actions/checkout@v3
15
- with :
16
- fetch-depth : 0
17
-
18
12
- name : Set up Node.js
19
13
uses : actions/setup-node@v3
20
14
with :
21
15
node-version : ' 18.x'
22
-
23
16
- name : Install dependencies
24
17
run : npm install
25
-
26
18
- name : Commit any changes (if needed)
27
19
run : |
28
20
git config user.name "github-actions[bot]"
34
26
run : |
35
27
current_version=$(npm version patch | sed 's/^v//')
36
28
echo "new_version=$current_version" >> $GITHUB_ENV
37
-
38
29
- name : Build the extension
39
30
run : npm run compile
40
31
@@ -46,26 +37,17 @@ jobs:
46
37
ls -lh
47
38
ls -lh *.vsix || echo "No .vsix file found!"
48
39
if [ -f *.vsix ]; then echo "vsix_file_exists=true" >> $GITHUB_ENV; else echo "vsix_file_exists=false" >> $GITHUB_ENV; fi
49
-
50
- - name : Create a tag
51
- if : success() && env.vsix_file_exists == 'true'
52
- run : |
53
- git tag ${{ env.new_version }}
54
- git push origin ${{ env.new_version }}
55
-
56
40
- name : Create GitHub Release
57
41
if : success() && env.vsix_file_exists == 'true'
58
42
uses : softprops/action-gh-release@v1
59
43
with :
60
44
files : ' *.vsix'
61
- tag_name : ${{ env.new_version }}
62
45
env :
63
46
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
64
47
65
48
- name : Publish to Visual Studio Marketplace
66
49
if : success() && env.vsix_file_exists == 'true'
67
50
run : |
68
- npm install -g vsce
69
51
vsce publish
70
52
env :
71
53
VSCE_PAT : ${{ secrets.VSCE_PAT }}
77
59
git config user.email "github-actions[bot]@users.noreply.github.com"
78
60
git add package.json
79
61
git commit -m "ci: bump version to ${{ env.new_version }}"
62
+ git tag ${{ env.new_version }}
80
63
git push origin main --tags
81
64
env :
82
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
65
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments