on: push: tags: ["duper-vs-code@*.*.*"] permissions: contents: read env: RUST_VERSION: "1.94.0" CARGO_INCREMENTAL: "0" CARGO_PROFILE_TEST_DEBUG: "0" NODE_VERSION: "22" jobs: build: strategy: fail-fast: false matrix: include: - runner: ubuntu-24.04 target: x86_64-unknown-linux-gnu vscode-target: linux-x64 os: linux - runner: ubuntu-24.04 target: aarch64-unknown-linux-gnu vscode-target: linux-arm64 os: linux - runner: ubuntu-24.04 target: x86_64-unknown-linux-musl vscode-target: alpine-x64 os: linux - runner: ubuntu-24.04 target: aarch64-unknown-linux-musl vscode-target: alpine-arm64 os: linux - runner: windows-latest target: x86_64-pc-windows-msvc vscode-target: win32-x64 os: windows - runner: windows-latest target: aarch64-pc-windows-msvc vscode-target: win32-arm64 os: windows - runner: macos-15 target: x86_64-apple-darwin vscode-target: darwin-x64 os: macos - runner: macos-15 target: aarch64-apple-darwin vscode-target: darwin-arm64 os: macos name: Build and package (${{ matrix.vscode-target }}) runs-on: ${{ matrix.runner }} steps: - name: Checkout repository uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 with: persist-credentials: true - name: Fetch MSRV and add target run: | rustup toolchain install ${RUST_VERSION} rustup override set ${RUST_VERSION} rustup target add ${{ matrix.target }} - name: Cache Rust dependencies uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1 - name: Install Zig if: matrix.runner == 'ubuntu-24.04' uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f # v2.0.5 with: version: latest - name: Install cargo-zigbuild (Linux) if: matrix.runner == 'ubuntu-24.04' uses: taiki-e/install-action@a24ba45235ed716ff76646268742990dc9458860 # v2.62.42 with: tool: cargo-zigbuild - name: Install lld (macOS) if: matrix.os == 'macos' run: | brew install lld - name: Install lld (Windows) if: matrix.os == 'windows' run: | choco install llvm - name: Build with cargo-zigbuild (Linux) if: matrix.runner == 'ubuntu-24.04' run: | cargo zigbuild --locked --all-features --release --target ${{ matrix.target }} --manifest-path duper_lsp/Cargo.toml - name: Build with cargo (macOS / Windows) if: matrix.runner != 'ubuntu-24.04' run: | cargo build --locked --all-features --release --target ${{ matrix.target }} --manifest-path duper_lsp/Cargo.toml - name: Copy binary to extension (Linux / macOS) if: matrix.os != 'windows' run: | cp target/${{ matrix.target }}/release/duper_lsp duper-vs-code/duper_lsp mkdir dist - name: Copy binary to extension (Windows) if: matrix.os == 'windows' shell: bash run: | cp target/${{ matrix.target }}/release/duper_lsp.exe duper-vs-code/duper_lsp.exe mkdir dist - name: Setup Node uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 with: node-version: ${{ env.NODE_VERSION }} - name: Build extension working-directory: duper-vs-code run: | npm ci npm run build npx vsce package --out "../dist/duper-vs-code-${{ matrix.vscode-target }}.vsix" --target ${{ matrix.vscode-target }} - name: Upload artifacts uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: dist-${{ matrix.vscode-target }} path: dist vscode: name: Release VSCode extension runs-on: ubuntu-24.04 environment: vsce needs: build steps: - name: Checkout repository uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 with: persist-credentials: true - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: name: dist-linux-x64 path: dist - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: name: dist-linux-arm64 path: dist - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: name: dist-alpine-x64 path: dist - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: name: dist-alpine-arm64 path: dist - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: name: dist-win32-x64 path: dist - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: name: dist-win32-arm64 path: dist - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: name: dist-darwin-x64 path: dist - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 with: name: dist-darwin-arm64 path: dist - run: | ls -al ./dist - name: Setup Node uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 with: node-version: ${{ env.NODE_VERSION }} - name: Install dependencies working-directory: duper-vs-code run: | npm ci - name: Publish to Visual Studio Marketplace working-directory: duper-vs-code run: | npx vsce publish --pat ${{ secrets.VSCE_TOKEN }} --packagePath ../dist/duper-vs-code-*.vsix - name: Publish to Open VSX working-directory: duper-vs-code run: | npx ovsx publish --pat ${{ secrets.OVSX_TOKEN }} --packagePath ../dist/duper-vs-code-*.vsix