config: add custom repository support for addonManager #424
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: 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 }} |