@@ -2,67 +2,74 @@ name: Publish
2
2
3
3
on :
4
4
pull_request :
5
- branches : [ main ]
5
+ branches : [main]
6
6
paths :
7
7
- " mcfunction.*"
8
8
push :
9
- branches : [ main ]
9
+ branches : [main]
10
10
tags : ["v*.*.*"]
11
11
12
12
jobs :
13
13
ci :
14
14
runs-on : ubuntu-latest
15
-
15
+
16
16
steps :
17
- # ---------------------------------------------
18
- # ----- gather repo -----
19
- # ---------------------------------------------
20
- - uses : actions/checkout@v3
21
- with :
22
- fetch-depth : 0
23
-
24
- - name : Use Node.js ${{ matrix.node-version }}
25
- uses : actions/setup-node@v3
26
- with :
27
- node-version : 20.x
28
- cache : npm
17
+ # ---------------------------------------------
18
+ # ----- gather repo -----
19
+ # ---------------------------------------------
20
+ - uses : actions/checkout@v3
21
+ with :
22
+ fetch-depth : 0
23
+
24
+ - name : Use Node.js ${{ matrix.node-version }}
25
+ uses : actions/setup-node@v3
26
+ with :
27
+ node-version : 20.x
28
+ cache : npm
29
+
30
+ - name : Install npm stuff
31
+ run : |
32
+ npm install -g @vscode/vsce
33
+ npm install -g js-yaml
34
+ npm install -g osvx
35
+
36
+ - name : Export JSON from YAML
37
+ run : js-yaml mcfunction.tmLanguage.yaml > mcfunction.tmLanguage.json
38
+
39
+ - name : Push JSON to repo for sublime (if not matched)
40
+ if : github.ref == 'refs/heads/main'
41
+ run : |
42
+ git config --global user.name "github-actions"
43
+ git config --global user.email "[email protected] "
44
+ git add mcfunction.tmLanguage.json
45
+ git commit -m "🤖 Generate JSON"
46
+ git push origin main
47
+ continue-on-error : true
48
+
49
+ - name : Package VSCode Ext
50
+ run : vsce package
51
+
52
+ - name : Archive production artifacts
53
+ uses : actions/upload-artifact@v3
54
+ if : " !startsWith(github.ref, 'refs/tags/')"
55
+ with :
56
+ name : dist-without-markdown
57
+ path : |
58
+ "*.vsix"
59
+ "mcfunction.tmLanguage.yaml"
60
+ "mcfunction.tmLanguage.json"
29
61
30
- - name : Install npm stuff
31
- run : |
32
- npm install -g @vscode/vsce
33
- npm install -g js-yaml
34
-
35
- - name : Export JSON from YAML
36
- run : js-yaml mcfunction.tmLanguage.yaml > mcfunction.tmLanguage.json
37
-
38
- - name : Push JSON to repo for sublime (if not matched)
39
- if : github.ref == 'refs/heads/main'
40
- run : |
41
- git config --global user.name "github-actions"
42
- git config --global user.email "[email protected] "
43
- git add mcfunction.tmLanguage.json
44
- git commit -m "🤖 Generate JSON"
45
- git push origin main
46
- continue-on-error : true
47
-
48
- - name : Package VSCode Ext
49
- run : vsce package
50
-
51
- - name : Archive production artifacts
52
- uses : actions/upload-artifact@v3
53
- if : " !startsWith(github.ref, 'refs/tags/')"
54
- with :
55
- name : dist-without-markdown
56
- path : |
57
- "*.vsix"
58
- "mcfunction.tmLanguage.yaml"
59
- "mcfunction.tmLanguage.json"
62
+ - name : Release
63
+ uses : softprops/action-gh-release@v1
64
+ if : startsWith(github.ref, 'refs/tags/')
65
+ with :
66
+ files : |
67
+ "*.vsix"
68
+ "mcfunction.tmLanguage.yaml"
69
+ "mcfunction.tmLanguage.json"
60
70
61
- - name : Release
62
- uses : softprops/action-gh-release@v1
63
- if : startsWith(github.ref, 'refs/tags/')
64
- with :
65
- files : |
66
- "*.vsix"
67
- "mcfunction.tmLanguage.yaml"
68
- "mcfunction.tmLanguage.json"
71
+ - name : Release to openvsix
72
+ if : startsWith(github.ref, 'refs/tags/')
73
+ run : |
74
+ VERSION=$(echo ${{ github.ref_name }} | sed 's/^v//')
75
+ npx ovsx publish syntax-mcfunction-$VERSION.vsix -p ${{ secrets.OVSX }}
0 commit comments