Skip to content

fix #335

fix #335 #32

name: release (AMXXPawn)
on:
push:
branches:
- main
jobs:
build:
name: Build ${{ matrix.target }}
if: "contains(github.event.head_commit.message, 'trigger-ci: amxxpawn')"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
program: cargo
platform: win32
arch: x64
archive: sourcepawn_lsp-x86_64-windows.zip
- os: windows-latest
target: i686-pc-windows-msvc
program: cargo
platform: win32
arch: ia32
archive: sourcepawn_lsp-i686-windows.zip
- os: windows-latest
target: aarch64-pc-windows-msvc
program: cargo
platform: win32
arch: arm64
archive: sourcepawn_lsp-aarch64-windows.zip
- os: macos-latest
target: x86_64-apple-darwin
program: cargo
platform: darwin
arch: x64
archive: sourcepawn_lsp-x86_64-macos.zip
- os: macos-latest
target: aarch64-apple-darwin
program: cargo
platform: darwin
arch: arm64
archive: sourcepawn_lsp-aarch64-macos.zip
- os: ubuntu-20.04
target: x86_64-unknown-linux-gnu
program: cargo
platform: linux
arch: x64
archive: sourcepawn_lsp-x86_64-linux.zip
- os: ubuntu-20.04
target: aarch64-unknown-linux-gnu
program: cross
platform: linux
arch: arm64
archive: sourcepawn_lsp-aarch64-linux.zip
- os: ubuntu-20.04
target: armv7-unknown-linux-gnueabihf
program: cross
platform: linux
arch: armhf
archive: sourcepawn_lsp-armv7hf-linux.zip
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: 16.x
- name: Setup Sentry CLI
uses: mathieu-bour/setup-sentry-cli@v1
with:
token: ${{ SECRETS.SENTRY_AUTH_TOKEN }}
organization: ${{ secrets.SENTRY_ORG }}
project: sourcepawn-lsp
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross
if: ${{ matrix.program == 'cross' }}
run: cargo install cross
- name: Install libssl-dev
if: ${{ contains(matrix.os, 'ubuntu') }}
run: sudo apt-get install pkg-config libssl-dev
- name: Compile
run: ${{ matrix.program }} build --target ${{ matrix.target }} --all-features --release --locked
- name: Compress (Windows)
if: ${{ contains(matrix.os, 'windows') }}
run: ${{ format('Compress-Archive target/{0}/release/sourcepawn_lsp.exe {1}', matrix.target, matrix.archive) }}
- name: Compress (macOS)
if: ${{ contains(matrix.os, 'macos') }}
run: ${{ format('zip -j {1} target/{0}/release/sourcepawn_lsp', matrix.target, matrix.archive) }}
- name: Compress (Linux)
if: ${{ contains(matrix.os, 'ubuntu') }}
run: ${{ format('zip -j {1} target/{0}/release/sourcepawn_lsp', matrix.target, matrix.archive) }}
- name: Upload debug symbols
run: sentry-cli upload-dif --wait target/${{ matrix.target }}/release/
- shell: pwsh
run: echo "target=${{ matrix.platform }}-${{ matrix.arch }}" >> $env:GITHUB_ENV
- name: Install npm dependencies
working-directory: ./editors/code-amxxpawn
run: npm install
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Bundle sourcepawn-lsp (Windows)
if: ${{ contains(matrix.os, 'windows') }}
shell: pwsh
run: |
mkdir -p editors/code-amxxpawn/languageServer
cp target/${{ matrix.target }}/release/sourcepawn_lsp.exe editors/code-amxxpawn/languageServer/
- name: Bundle sourcepawn-lsp
if: ${{ !contains(matrix.os, 'windows') }}
shell: pwsh
run: |
mkdir -p editors/code-amxxpawn/languageServer
cp target/${{ matrix.target }}/release/sourcepawn_lsp editors/code-amxxpawn/languageServer/
- name: Package VSCode extension
working-directory: ./editors/code-amxxpawn
run: npx vsce package --target ${{ env.target }}
- name: Upload sourcepawn-lsp binary
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.target }}
path: ${{ matrix.archive }}
- name: Upload VSIX package
uses: actions/upload-artifact@v3
with:
name: ${{ env.target }}
path: "editors/code-amxxpawn/*.vsix"
marketplace:
name: Publish to VSCode marketplace
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
- name: Publish VSIX package (Release)
if: ${{ !github.event.prerelease }}
run: npx vsce publish --packagePath $(find . -iname *.vsix)
env:
VSCE_PAT: ${{ secrets.VSCE_TOKEN }}
- name: Publish VSIX package (Prerelease)
if: ${{ github.event.prerelease }}
run: npx vsce publish --packagePath $(find . -iname *.vsix) --pre-release
env:
VSCE_PAT: ${{ secrets.VSCE_TOKEN }}
ovsx:
name: Publish to Open VSX
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
- name: Publish VSIX package (Release)
if: ${{ !github.event.prerelease }}
run: npx ovsx publish -p $OVSX_TOKEN --packagePath $(find . -iname *.vsix)
env:
OVSX_TOKEN: ${{ secrets.OVSX_TOKEN }}
- name: Publish VSIX package (Prerelease)
if: ${{ github.event.prerelease }}
run: npx ovsx publish -p $OVSX_TOKEN --packagePath $(find . -iname *.vsix) --pre-release
env:
OVSX_TOKEN: ${{ secrets.OVSX_TOKEN }}