release #62
Workflow file for this run
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 checks to succeed | |
uses: poseidon/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
interval: 5 | |
dist: | |
strategy: | |
# don't cancel other jobs when one fails | |
fail-fast: false | |
matrix: | |
include: | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
code-target: win32-x64 | |
- 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: x86_64-unknown-linux-musl | |
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-latest | |
target: x86_64-apple-darwin | |
code-target: darwin-x64 | |
- os: macos-latest | |
target: aarch64-apple-darwin | |
code-target: darwin-arm64 | |
name: dist (${{ matrix.target }}) | |
runs-on: ${{ matrix.os }} | |
needs: wait | |
steps: | |
- uses: actions/checkout@v4 | |
# needed for arm targets | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.target }} | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install GCC arm64 (linux) | |
if: matrix.target == 'aarch64-unknown-linux-gnu' | |
run: sudo apt-get update && sudo apt-get install gcc-aarch64-linux-gnu | |
- name: Install GCC armhf (linux) | |
if: matrix.target == 'arm-unknown-linux-gnueabihf' | |
run: sudo apt-get update && sudo apt-get install gcc-arm-linux-gnueabihf | |
- run: cargo build --target ${{ matrix.target }} --release | |
- run: npm ci | |
- name: vsce package | |
# use bash on windows | |
shell: bash | |
run: | | |
mkdir -p bundled dist | |
cp target/${{ matrix.target }}/release/typos-lsp* bundled/ | |
npx vsce package -o dist/ --target ${{ matrix.code-target }} | |
- name: Archive | |
shell: bash | |
run: | | |
ver=${GITHUB_REF/refs\/*\//} | |
archive="typos-lsp-$ver-${{ matrix.target }}" | |
if [ "${{ matrix.os }}" == "windows-latest" ]; then | |
7z a "dist/${archive}.zip" target/${{ matrix.target }}/release/typos-lsp.exe | |
else | |
tar czf "dist/${archive}.tar.gz" -C target/${{ matrix.target }}/release typos-lsp | |
fi | |
ls -al dist/* | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.target }} | |
path: dist | |
- name: Start sshx session on failed manual attempt | |
if: ${{ failure() && (github.event_name == 'workflow_dispatch' || github.run_attempt > 1) }} | |
run: curl -sSf https://sshx.io/get | sh && sshx | |
publish: | |
runs-on: ubuntu-latest | |
needs: dist | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
# download each artifact into its own self-named directory | |
- uses: actions/download-artifact@v4 | |
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: ovsx publish | |
run: npx ovsx publish --packagePath $(npx glob dist/**/*.vsix) | |
env: | |
OVSX_PAT: ${{ secrets.OVSX_PAT }} | |
- name: Upload to GH release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: dist/**/* | |
- name: Start sshx session on failed manual attempt | |
if: ${{ failure() && (github.event_name == 'workflow_dispatch' || github.run_attempt > 1) }} | |
run: curl -sSf https://sshx.io/get | sh && sshx |