-
-
Notifications
You must be signed in to change notification settings - Fork 52
139 lines (119 loc) · 3.85 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: build
permissions:
contents: write
on:
push:
branches:
- master
tags:
- "*"
pull_request:
branches:
- master
env:
PROJECT: vscode-lua
BIN_DIR: server/bin
PKG_SUFFIX: vsix
jobs:
compile:
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-20.04, target: linux, platform: linux-x64 }
- { os: ubuntu-20.04, target: linux, platform: linux-arm64 }
- { os: macos-latest, target: darwin, platform: darwin-x64 }
- { os: macos-latest, target: darwin, platform: darwin-arm64 }
#- { os: windows-latest, target: windows, platform: win32-ia32 } # 不再支持32位
- { os: windows-latest, target: windows, platform: win32-x64 }
runs-on: ${{ matrix.os }}
steps:
- name: Install aarch64-linux-gnu
if: ${{ matrix.platform == 'linux-arm64' }}
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '22' # 指定要安装的 Node.js 版本
- name: Build for Windows
if: ${{ matrix.target == 'windows' }}
working-directory: ./server
run: |
.\make.bat ${{ matrix.platform }}
rm -r ./build
- name: Build for Linux
if: ${{ matrix.target == 'linux' }}
working-directory: ./server
run: |
sudo apt update
sudo apt install ninja-build
./make.sh ${{ matrix.platform }}
rm -r ./build
- name: Build for macOS
if: ${{ matrix.target == 'darwin' }}
working-directory: ./server
run: |
brew install ninja
./make.sh ${{ matrix.platform }}
rm -r ./build
- name: Setting up workflow variables
id: vars
shell: bash
run: |
# Package version
if [[ $GITHUB_REF = refs/tags/* ]]; then
PKG_VERSION=${GITHUB_REF##*/}
else
PKG_VERSION=${GITHUB_SHA:0:7}
fi
# Package name w/ version
PKG_BASENAME="${{ env.PROJECT }}-${PKG_VERSION}-${{ matrix.platform }}"
# Full name of the tarball asset
PKG_NAME="${PKG_BASENAME}.${PKG_SUFFIX}"
echo PKG_BASENAME=${PKG_BASENAME} >> $GITHUB_OUTPUT
echo PKG_NAME=${PKG_NAME} >> $GITHUB_OUTPUT
- name: Compile client
shell: bash
run: |
npm install -g typescript
cd client
npm ci
npm run build
cd ..
- name: Build Addon Manager WebVue
shell: bash
run: |
cd client/webvue
npm ci
npm run build
cd ../..
- name: Pack vsix
id: pack
shell: bash
run: |
npm install -g @vscode/vsce
vsce package -o ${{ steps.vars.outputs.PKG_NAME }} -t ${{ matrix.platform }}
- uses: actions/upload-artifact@v4
with:
name: ${{ steps.vars.outputs.PKG_BASENAME }}
path: ${{ steps.vars.outputs.PKG_NAME }}
- name: Publish release assets
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
generate_release_notes: true
files: |
${{ steps.vars.outputs.PKG_NAME }}
- name: Publish to VSCode Market
if: startsWith(github.ref, 'refs/tags/')
run: vsce publish -i ${{ steps.vars.outputs.PKG_NAME }} -p ${{ secrets.VSCE_TOKEN }}
- name: Publish to Open VSX Registry
if: startsWith(github.ref, 'refs/tags/')
run: |
npm install -g ovsx
ovsx publish -i ${{ steps.vars.outputs.PKG_NAME }} -p ${{ secrets.OVSX_TOKEN }}