|
| 1 | +name: Release VS Code extension |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'vscode-v*' |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + name: Build (${{ matrix.vsce_target }}) |
| 14 | + runs-on: ${{ matrix.os }} |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + include: |
| 19 | + - os: macos-latest |
| 20 | + rust_target: aarch64-apple-darwin |
| 21 | + vsce_target: darwin-arm64 |
| 22 | + exe_suffix: "" |
| 23 | + - os: ubuntu-latest |
| 24 | + rust_target: x86_64-unknown-linux-gnu |
| 25 | + vsce_target: linux-x64 |
| 26 | + exe_suffix: "" |
| 27 | + - os: windows-latest |
| 28 | + rust_target: x86_64-pc-windows-msvc |
| 29 | + vsce_target: win32-x64 |
| 30 | + exe_suffix: ".exe" |
| 31 | + steps: |
| 32 | + - uses: actions/checkout@v4 |
| 33 | + |
| 34 | + - name: Setup Rust toolchain |
| 35 | + uses: dtolnay/rust-toolchain@stable |
| 36 | + with: |
| 37 | + targets: ${{ matrix.rust_target }} |
| 38 | + |
| 39 | + - name: Cache cargo registry & build |
| 40 | + uses: Swatinem/rust-cache@v2 |
| 41 | + with: |
| 42 | + workspaces: cli |
| 43 | + |
| 44 | + - name: Build engage + engage-lsp |
| 45 | + working-directory: cli |
| 46 | + run: cargo build --release --target ${{ matrix.rust_target }} --bins |
| 47 | + |
| 48 | + - name: Setup Node.js |
| 49 | + uses: actions/setup-node@v4 |
| 50 | + with: |
| 51 | + node-version: 20 |
| 52 | + |
| 53 | + - name: Install extension dependencies |
| 54 | + working-directory: vscode |
| 55 | + run: npm ci |
| 56 | + |
| 57 | + - name: Compile extension TypeScript |
| 58 | + working-directory: vscode |
| 59 | + run: npm run compile |
| 60 | + |
| 61 | + - name: Stage binaries into extension |
| 62 | + shell: bash |
| 63 | + run: | |
| 64 | + set -euo pipefail |
| 65 | + mkdir -p vscode/bin |
| 66 | + cp "cli/target/${{ matrix.rust_target }}/release/engage${{ matrix.exe_suffix }}" "vscode/bin/" |
| 67 | + cp "cli/target/${{ matrix.rust_target }}/release/engage-lsp${{ matrix.exe_suffix }}" "vscode/bin/" |
| 68 | +
|
| 69 | + - name: Package VSIX |
| 70 | + working-directory: vscode |
| 71 | + run: npx vsce package --target ${{ matrix.vsce_target }} --out engage-${{ github.ref_name }}-${{ matrix.vsce_target }}.vsix |
| 72 | + |
| 73 | + - name: Upload to release |
| 74 | + uses: softprops/action-gh-release@v2 |
| 75 | + with: |
| 76 | + files: vscode/engage-${{ github.ref_name }}-${{ matrix.vsce_target }}.vsix |
| 77 | + fail_on_unmatched_files: true |
0 commit comments