Skip to content

release

release #68

Workflow file for this run

name: release
on:
release:
types: [created]
jobs:
build:
name: Build ${{ matrix.target }}
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-studio-${{ github.event.release.tag_name }}-windows-amd64.zip
- os: windows-latest
target: i686-pc-windows-msvc
program: cargo
platform: win32
arch: ia32
archive: sourcepawn-studio-${{ github.event.release.tag_name }}-windows-i686.zip
- os: windows-latest
target: aarch64-pc-windows-msvc
program: cargo
platform: win32
arch: arm64
archive: sourcepawn-studio-${{ github.event.release.tag_name }}-windows-arm64.zip
- os: macos-latest
target: x86_64-apple-darwin
program: cargo
platform: darwin
arch: x64
archive: sourcepawn-studio-${{ github.event.release.tag_name }}-darwin-amd64.tar.gz
- os: macos-latest
target: aarch64-apple-darwin
program: cargo
platform: darwin
arch: arm64
archive: sourcepawn-studio-${{ github.event.release.tag_name }}-darwin-arm64.tar.gz
- os: ubuntu-20.04
target: x86_64-unknown-linux-gnu
program: cargo
platform: linux
arch: x64
archive: sourcepawn-studio-${{ github.event.release.tag_name }}-linux-amd64.tar.gz
- os: ubuntu-20.04
target: aarch64-unknown-linux-gnu
program: cross
platform: linux
arch: arm64
archive: sourcepawn-studio-${{ github.event.release.tag_name }}-linux-arm64.tar.gz
- os: ubuntu-20.04
target: armv7-unknown-linux-gnueabihf
program: cross
platform: linux
arch: armhf
archive: sourcepawn-studio-${{ github.event.release.tag_name }}-linux-armv7.tar.gz
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.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-studio.exe {1}', matrix.target, matrix.archive) }}
- name: Compress (macOS)
if: ${{ contains(matrix.os, 'macos') }}
run: ${{ format('gtar -czvf {1} -C target/{0}/release sourcepawn-studio', matrix.target, matrix.archive) }}
- name: Compress (Linux)
if: ${{ contains(matrix.os, 'ubuntu') }}
run: ${{ format('tar -czvf {1} -C target/{0}/release sourcepawn-studio', 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
run: npm install
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Bundle sourcepawn-studio (Windows)
if: ${{ contains(matrix.os, 'windows') }}
shell: pwsh
run: |
mkdir -p editors/code/languageServer
cp target/${{ matrix.target }}/release/sourcepawn-studio.exe editors/code/languageServer/
- name: Bundle sourcepawn-studio
if: ${{ !contains(matrix.os, 'windows') }}
shell: pwsh
run: |
mkdir -p editors/code/languageServer
cp target/${{ matrix.target }}/release/sourcepawn-studio editors/code/languageServer/
- name: Package VSCode extension (Release)
if: ${{ !github.event.release.prerelease }}
working-directory: ./editors/code
run: npx vsce package --target ${{ env.target }}
- name: Package VSCode extension (Prerelease)
if: ${{ github.event.release.prerelease }}
working-directory: ./editors/code
run: npx vsce package --pre-release --target ${{ env.target }}
- name: Upload sourcepawn-studio 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/*.vsix"
github:
name: Publish releases
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
- name: Publish binaries
run: |
gh release upload ${{ github.ref_name }} $(find . -iname sourcepawn-studio*.zip)
gh release upload ${{ github.ref_name }} $(find . -iname sourcepawn-studio*.tar.gz)
gh release upload ${{ github.ref_name }} $(find . -iname *.vsix)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
marketplace:
name: Publish to VSCode marketplace
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
- name: Publish VSIX package (Release)
if: ${{ !github.event.release.prerelease }}
run: npx vsce publish --packagePath $(find . -iname '*.vsix' ! -iname '*win32-ia32*')
env:
VSCE_PAT: ${{ secrets.VSCE_TOKEN }}
- name: Publish VSIX package (Prerelease)
if: ${{ github.event.release.prerelease }}
run: npx vsce publish --packagePath $(find . -iname '*.vsix' ! -iname '*win32-ia32*') --pre-release
env:
VSCE_PAT: ${{ secrets.VSCE_TOKEN }}
ovsx:
name: Publish to Open VSX
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
- name: Publish VSIX package (Release)
if: ${{ !github.event.release.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.release.prerelease }}
run: npx ovsx publish -p $OVSX_TOKEN --packagePath $(find . -iname *.vsix) --pre-release
env:
OVSX_TOKEN: ${{ secrets.OVSX_TOKEN }}
edit-release:
runs-on: ubuntu-latest
needs: [github]
steps:
- uses: actions/checkout@v4
- name: Get Changelog Entry
id: changelog_sourcepawn_lsp
uses: mindsers/changelog-reader-action@v2
with:
path: ./CHANGELOG.md
- name: Get Changelog Entry
id: changelog_vscode_extension
uses: mindsers/changelog-reader-action@v2
with:
path: ./editors/code/CHANGELOG.md
- name: Edit Release
uses: irongut/EditRelease@v1.2.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
id: ${{ github.event.release.id }}
body: "# Language Server\n\n${{ steps.changelog_sourcepawn_lsp.outputs.changes }}\n\n# VSCode Extension\n\n${{ steps.changelog_vscode_extension.outputs.changes }}"
replacebody: true
homebrew:
name: Release on Homebrew
runs-on: ubuntu-latest
needs: [build, github]
steps:
- name: Release to Homebrew tap
if: ${{ !github.event.release.prerelease }}
uses: Justintime50/homebrew-releaser@v1
with:
homebrew_owner: Sarrus1
homebrew_tap: homebrew-formulas
formula_folder: formula
github_token: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
commit_owner: Sarrus1
commit_email: 63302440+Sarrus1@users.noreply.github.com
install: 'bin.install "sourcepawn-studio" => "sourcepawn-studio"'
target_darwin_amd64: true
target_darwin_arm64: true
target_linux_amd64: true
target_linux_arm64: true
update_readme_table: true
skip_commit: false
debug: true