Skip to content

Commit 0d516cb

Browse files
committed
feat: added github action release
1 parent 2927d5f commit 0d516cb

File tree

3 files changed

+3043
-90
lines changed

3 files changed

+3043
-90
lines changed

.github/workflows/release.yml

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
name: Build and Release VSCode Extension
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- 'v*'
9+
pull_request:
10+
branches:
11+
- main
12+
workflow_dispatch:
13+
14+
jobs:
15+
test:
16+
strategy:
17+
matrix:
18+
os: [macos-latest, ubuntu-latest, windows-latest]
19+
runs-on: ${{ matrix.os }}
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Install Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: 20.x
28+
cache: 'npm'
29+
30+
- name: Install dependencies
31+
run: npm install
32+
33+
- name: Run tests on Linux (with xvfb)
34+
run: xvfb-run -a npm test
35+
if: runner.os == 'Linux'
36+
37+
- name: Run tests on macOS/Windows
38+
run: npm test
39+
if: runner.os != 'Linux'
40+
41+
build-and-release:
42+
# 태그가 푸시된 경우에만 릴리스 실행
43+
if: startsWith(github.ref, 'refs/tags/v')
44+
needs: test
45+
runs-on: ubuntu-latest
46+
47+
steps:
48+
- name: Checkout code
49+
uses: actions/checkout@v4
50+
51+
- name: Setup Node.js
52+
uses: actions/setup-node@v4
53+
with:
54+
node-version: 20.x
55+
cache: 'npm'
56+
57+
- name: Install dependencies
58+
run: npm install
59+
60+
- name: Install vsce (Visual Studio Code Extension Manager)
61+
run: npm install -g @vscode/vsce
62+
63+
- name: Prepublish tasks
64+
run: npm run vscode:prepublish
65+
66+
- name: Package extension
67+
run: vsce package
68+
69+
- name: Get extension info
70+
id: extension_info
71+
run: |
72+
VSIX_FILE=$(ls *.vsix | head -1)
73+
echo "vsix_file=$VSIX_FILE" >> $GITHUB_OUTPUT
74+
echo "extension_name=${VSIX_FILE}" >> $GITHUB_OUTPUT
75+
VERSION=${GITHUB_REF#refs/tags/}
76+
echo "version=$VERSION" >> $GITHUB_OUTPUT
77+
78+
- name: Create Release
79+
id: create_release
80+
uses: actions/create-release@v1
81+
env:
82+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83+
with:
84+
tag_name: ${{ github.ref_name }}
85+
release_name: Release ${{ steps.extension_info.outputs.version }}
86+
body: |
87+
## VSCode Extension Release ${{ steps.extension_info.outputs.version }}
88+
89+
### Installation Instructions
90+
1. Download the `.vsix` file from the assets below
91+
2. Open VSCode
92+
3. Press `Ctrl+Shift+P` (or `Cmd+Shift+P` on Mac)
93+
4. Type "Extensions: Install from VSIX..."
94+
5. Select the downloaded `.vsix` file
95+
96+
### Alternative Installation via Command Line
97+
```bash
98+
code --install-extension ${{ steps.extension_info.outputs.extension_name }}
99+
```
100+
101+
### Tested Platforms
102+
- ✅ Windows Latest
103+
- ✅ macOS Latest
104+
- ✅ Ubuntu Latest
105+
106+
### Files
107+
- `${{ steps.extension_info.outputs.extension_name }}` - VSCode Extension Package
108+
109+
---
110+
*This release was automatically built and tested on multiple platforms.*
111+
draft: false
112+
prerelease: false
113+
114+
- name: Upload Release Asset
115+
uses: actions/upload-release-asset@v1
116+
env:
117+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
118+
with:
119+
upload_url: ${{ steps.create_release.outputs.upload_url }}
120+
asset_path: ./${{ steps.extension_info.outputs.vsix_file }}
121+
asset_name: ${{ steps.extension_info.outputs.vsix_file }}
122+
asset_content_type: application/octet-stream
123+
124+
- name: Upload build artifacts
125+
uses: actions/upload-artifact@v4
126+
with:
127+
name: vscode-extension-${{ steps.extension_info.outputs.version }}
128+
path: '*.vsix'
129+
retention-days: 30
130+
131+
- name: Comment on related issues
132+
uses: actions/github-script@v7
133+
with:
134+
script: |
135+
const version = '${{ steps.extension_info.outputs.version }}';
136+
github.rest.repos.createRelease({
137+
owner: context.repo.owner,
138+
repo: context.repo.repo,
139+
tag_name: version,
140+
name: `Release ${version}`,
141+
body: `🎉 New version ${version} has been released!\n\nDownload the extension: [${context.payload.repository.html_url}/releases/tag/${version}](${context.payload.repository.html_url}/releases/tag/${version})`
142+
});
143+

0 commit comments

Comments
 (0)