release #24
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: release | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
jobs: | |
wait: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Wait for build check to succeed | |
uses: lewagon/[email protected] | |
with: | |
ref: ${{ github.ref }} | |
check-regexp: build.* | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
wait-interval: 5 | |
dist: | |
strategy: | |
matrix: | |
include: | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
code-target: win32-x64 | |
- os: windows-latest | |
target: i686-pc-windows-msvc | |
code-target: win32-ia32 | |
- os: windows-latest | |
target: aarch64-pc-windows-msvc | |
code-target: win32-arm64 | |
- os: ubuntu-20.04 | |
target: x86_64-unknown-linux-gnu | |
code-target: linux-x64 | |
- os: ubuntu-20.04 | |
target: aarch64-unknown-linux-gnu | |
code-target: linux-arm64 | |
- os: ubuntu-20.04 | |
target: arm-unknown-linux-gnueabihf | |
code-target: linux-armhf | |
- os: macos-11 | |
target: x86_64-apple-darwin | |
code-target: darwin-x64 | |
- os: macos-11 | |
target: aarch64-apple-darwin | |
code-target: darwin-arm64 | |
name: dist (${{ matrix.target }}) | |
runs-on: ${{ matrix.os }} | |
needs: wait | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: Swatinem/rust-cache@v2 | |
# needed for arm targets | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
target: ${{ matrix.target }} | |
- run: cargo build --target ${{ matrix.target }} --release | |
- run: npm ci | |
- name: vsce package (unix) | |
if: matrix.os != 'windows-latest' | |
run: | | |
mkdir -p bundled dist | |
cp target/release/typos-lsp bundled/ | |
npx vsce package -o dist/ --target ${{ matrix.code-target }} | |
- name: vsce package (windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
mkdir bundled,dist | |
copy target\release\typos-lsp.exe bundled\ | |
npx vsce package -o dist\ --target ${{ matrix.code-target }} | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.target }} | |
path: dist | |
publish: | |
runs-on: ubuntu-latest | |
needs: dist | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
# download each artifact into its own self-named directory | |
- uses: actions/download-artifact@v3 | |
with: | |
path: dist | |
- run: npm ci | |
- name: Inspect dist | |
run: | | |
ls -al dist/* | |
npx glob dist/**/*.vsix | |
- name: vsce publish | |
run: npx vsce publish --packagePath $(npx glob dist/**/*.vsix) | |
env: | |
VSCE_PAT: ${{ secrets.VSCE_PAT }} | |
- name: Upload to GH release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: dist/**/*.vsix | |
- name: Setup tmate session | |
if: ${{ failure() }} | |
uses: mxschmitt/action-tmate@v3 |