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