Skip to content

Commit b23e154

Browse files
ci: add github workflow
1 parent 1611021 commit b23e154

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

.github/workflows/plugin.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Build Plugin
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
outputs:
12+
zip_name: ${{ steps.zipname.outputs.zip_name }}
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: '18'
21+
22+
- name: Install Dependencies
23+
run: npm install
24+
25+
- name: Build Plugin
26+
run: npm run build
27+
28+
- name: Set zip name
29+
id: zipname
30+
run: |
31+
REPO_NAME="${GITHUB_REPOSITORY##*/}"
32+
ZIP_NAME="${REPO_NAME}.zip"
33+
echo "ZIP_NAME=$ZIP_NAME" >> $GITHUB_ENV
34+
echo "zip_name=$ZIP_NAME" >> $GITHUB_OUTPUT
35+
36+
- name: Zip build output
37+
run: |
38+
REPO_NAME="${GITHUB_REPOSITORY##*/}"
39+
mv dist "$REPO_NAME"
40+
zip -r "$ZIP_NAME" "$REPO_NAME"
41+
42+
- name: Upload artifact
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: plugin-zip
46+
path: ${{ env.ZIP_NAME }}
47+
48+
release:
49+
needs: build
50+
runs-on: ubuntu-latest
51+
52+
steps:
53+
- name: Checkout code
54+
uses: actions/checkout@v4
55+
56+
- name: Download artifact
57+
uses: actions/download-artifact@v4
58+
with:
59+
name: plugin-zip
60+
path: .
61+
62+
- name: Create GitHub Release
63+
uses: softprops/action-gh-release@v2
64+
with:
65+
files: ${{ needs.build.outputs.zip_name }}
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)