Skip to content

Commit 8913984

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

File tree

3 files changed

+3040
-90
lines changed

3 files changed

+3040
-90
lines changed

.github/workflows/release.yml

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
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: Package extension
64+
run: vsce package
65+
66+
- name: Get extension info
67+
id: extension_info
68+
run: |
69+
VSIX_FILE=$(ls *.vsix | head -1)
70+
echo "vsix_file=$VSIX_FILE" >> $GITHUB_OUTPUT
71+
echo "extension_name=${VSIX_FILE}" >> $GITHUB_OUTPUT
72+
VERSION=${GITHUB_REF#refs/tags/}
73+
echo "version=$VERSION" >> $GITHUB_OUTPUT
74+
75+
- name: Create Release
76+
id: create_release
77+
uses: actions/create-release@v1
78+
env:
79+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80+
with:
81+
tag_name: ${{ github.ref_name }}
82+
release_name: Release ${{ steps.extension_info.outputs.version }}
83+
body: |
84+
## VSCode Extension Release ${{ steps.extension_info.outputs.version }}
85+
86+
### Installation Instructions
87+
1. Download the `.vsix` file from the assets below
88+
2. Open VSCode
89+
3. Press `Ctrl+Shift+P` (or `Cmd+Shift+P` on Mac)
90+
4. Type "Extensions: Install from VSIX..."
91+
5. Select the downloaded `.vsix` file
92+
93+
### Alternative Installation via Command Line
94+
```bash
95+
code --install-extension ${{ steps.extension_info.outputs.extension_name }}
96+
```
97+
98+
### Tested Platforms
99+
- ✅ Windows Latest
100+
- ✅ macOS Latest
101+
- ✅ Ubuntu Latest
102+
103+
### Files
104+
- `${{ steps.extension_info.outputs.extension_name }}` - VSCode Extension Package
105+
106+
---
107+
*This release was automatically built and tested on multiple platforms.*
108+
draft: false
109+
prerelease: false
110+
111+
- name: Upload Release Asset
112+
uses: actions/upload-release-asset@v1
113+
env:
114+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
115+
with:
116+
upload_url: ${{ steps.create_release.outputs.upload_url }}
117+
asset_path: ./${{ steps.extension_info.outputs.vsix_file }}
118+
asset_name: ${{ steps.extension_info.outputs.vsix_file }}
119+
asset_content_type: application/octet-stream
120+
121+
- name: Upload build artifacts
122+
uses: actions/upload-artifact@v4
123+
with:
124+
name: vscode-extension-${{ steps.extension_info.outputs.version }}
125+
path: '*.vsix'
126+
retention-days: 30
127+
128+
- name: Comment on related issues
129+
uses: actions/github-script@v7
130+
with:
131+
script: |
132+
const version = '${{ steps.extension_info.outputs.version }}';
133+
github.rest.repos.createRelease({
134+
owner: context.repo.owner,
135+
repo: context.repo.repo,
136+
tag_name: version,
137+
name: `Release ${version}`,
138+
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})`
139+
});
140+

0 commit comments

Comments
 (0)