@@ -3,43 +3,39 @@ name: Basic CI
3
3
on :
4
4
push :
5
5
branches :
6
- - " master" # Trigger only on pushes to the master branch
6
+ - " master"
7
7
pull_request :
8
8
branches :
9
- - " master" # Trigger on pull requests targeting the master branch
9
+ - " master"
10
10
release :
11
11
types :
12
- - created # Run when a new release is created
12
+ - created
13
13
14
14
jobs :
15
15
test :
16
16
name : Run Tests
17
- runs-on : ubuntu-latest # Use Ubuntu for the runner
17
+ runs-on : ubuntu-latest
18
18
19
19
steps :
20
- # Step 1: Checkout the code
21
20
- name : Checkout code
22
21
uses : actions/checkout@v4
23
22
24
- # Step 2: Set up Node.js
25
23
- name : Setup Node.js
26
24
uses : actions/setup-node@v4
27
25
with :
28
- node-version : " 16" # Specify the Node.js version
26
+ node-version : " 16"
29
27
30
- # Step 3: Install dependencies
31
28
- name : Install dependencies
32
29
run : npm install
33
30
34
- # Step 4: Compile the project
35
31
- name : Compile the project
36
- run : npm run compile
32
+ run : npm run compile
37
33
38
34
publish :
39
35
name : Package & Upload VSIX (Fake Publish in Fork, Real in Main)
40
36
runs-on : ubuntu-latest
41
- needs : test # Ensure tests pass before publishing
42
- if : github.event_name == 'release' # Ensure it only runs on a new release
37
+ needs : test
38
+ if : github.event_name == 'release'
43
39
44
40
steps :
45
41
- name : Checkout Repository
@@ -57,32 +53,23 @@ jobs:
57
53
run : npm install
58
54
59
55
- name : Build Extension
60
- run : npm run compile # Change if needed
56
+ run : npm run compile
61
57
62
- # Step 5: Package the VSIX file and ensure "dist" directory exists
63
- - name : Package the VSIX file
64
- run : |
65
- mkdir -p dist # Create the dist folder if it doesn't exist
66
- vsce package -o dist/extension.vsix # Generate the VSIX file in "dist/"
58
+ - name : Ensure dist directory exists
59
+ run : mkdir -p dist
67
60
68
- # Step 6: Debugging Step - List dist directory
69
- - name : Debug: List dist directory
70
- run : ls -la dist/
61
+ - name : Package the VSIX file
62
+ run : vsce package -o dist/extension.vsix
71
63
72
- # Step 7: Upload VSIX file as an artifact
73
64
- name : Upload VSIX Artifact
74
65
uses : actions/upload-artifact@v4
75
66
with :
76
67
name : vscode-extension
77
68
path : dist/*.vsix
78
69
79
- # Step 8: Fake Publish on Fork, Real Publish on Main
80
70
- name : Fake Publish (If Fork) or Real Publish
81
- env :
82
- IS_FORK : ${{ github.repository_owner == 'hhpatel14' }}
83
71
run : |
84
- echo "Checking if this is a fork..."
85
- if [ "$IS_FORK" = "true" ]; then
72
+ if [ "${{ github.repository_owner }}" = "hhpatel14" ]; then
86
73
echo "This is a fork. Running fake publish..."
87
74
else
88
75
echo "This is the main repo. Publishing to VS Code Marketplace..."
0 commit comments