fix(84): resolve VSIX path via step output instead of glob #3
This file contains hidden or 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: | |
| push: | |
| branches: [main] | |
| tags: ['v*'] | |
| pull_request: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build (${{ matrix.target }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: x86_64-apple-darwin | |
| os: macos-15-intel | |
| llvm_method: brew | |
| archive_ext: tar.gz | |
| - target: aarch64-apple-darwin | |
| os: macos-14 | |
| llvm_method: brew | |
| archive_ext: tar.gz | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-24.04 | |
| llvm_method: tarball | |
| archive_ext: tar.gz | |
| - target: aarch64-unknown-linux-gnu | |
| os: ubuntu-24.04-arm | |
| llvm_method: tarball | |
| archive_ext: tar.gz | |
| - target: x86_64-unknown-linux-musl | |
| os: ubuntu-24.04 | |
| llvm_method: tarball | |
| archive_ext: tar.gz | |
| - target: x86_64-pc-windows-msvc | |
| os: windows-latest | |
| llvm_method: tarball | |
| archive_ext: zip | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # ── LLVM 21 Installation ────────────────────────────────────── | |
| - name: Cache LLVM | |
| if: matrix.llvm_method == 'tarball' | |
| uses: actions/cache@v4 | |
| id: cache-llvm | |
| with: | |
| path: ~/llvm | |
| key: llvm-21-${{ matrix.target }} | |
| - name: Install LLVM 21 (Homebrew) | |
| if: matrix.llvm_method == 'brew' | |
| run: | | |
| brew install llvm@21 | |
| echo "LLVM_SYS_211_PREFIX=$(brew --prefix llvm@21)" >> "$GITHUB_ENV" | |
| - name: Install LLVM 21 (Linux x86_64) | |
| if: >- | |
| matrix.llvm_method == 'tarball' && | |
| (matrix.target == 'x86_64-unknown-linux-gnu' || matrix.target == 'x86_64-unknown-linux-musl') && | |
| steps.cache-llvm.outputs.cache-hit != 'true' | |
| run: | | |
| LLVM_VERSION="21.1.8" | |
| LLVM_ARCHIVE="clang+llvm-${LLVM_VERSION}-x86_64-pc-linux-gnu.tar.xz" | |
| LLVM_URL="https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/${LLVM_ARCHIVE}" | |
| curl -sSfL "$LLVM_URL" -o llvm.tar.xz | |
| mkdir -p "$HOME/llvm" | |
| tar xf llvm.tar.xz --strip-components=1 -C "$HOME/llvm" | |
| rm llvm.tar.xz | |
| - name: Install LLVM 21 (Linux ARM64) | |
| if: >- | |
| matrix.llvm_method == 'tarball' && | |
| matrix.target == 'aarch64-unknown-linux-gnu' && | |
| steps.cache-llvm.outputs.cache-hit != 'true' | |
| run: | | |
| LLVM_VERSION="21.1.3" | |
| LLVM_ARCHIVE="clang+llvm-${LLVM_VERSION}-aarch64-linux-gnu.tar.xz" | |
| LLVM_URL="https://github.com/ycm-core/llvm/releases/download/${LLVM_VERSION}/${LLVM_ARCHIVE}" | |
| curl -sSfL "$LLVM_URL" -o llvm.tar.xz | |
| mkdir -p "$HOME/llvm" | |
| tar xf llvm.tar.xz --strip-components=1 -C "$HOME/llvm" | |
| rm llvm.tar.xz | |
| - name: Install LLVM 21 (Windows) | |
| if: >- | |
| matrix.llvm_method == 'tarball' && | |
| matrix.target == 'x86_64-pc-windows-msvc' && | |
| steps.cache-llvm.outputs.cache-hit != 'true' | |
| shell: pwsh | |
| run: | | |
| $LLVM_VERSION = "21.1.8" | |
| $LLVM_ARCHIVE = "clang+llvm-${LLVM_VERSION}-x86_64-pc-windows-msvc.tar.xz" | |
| $LLVM_URL = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/${LLVM_ARCHIVE}" | |
| Invoke-WebRequest -Uri $LLVM_URL -OutFile llvm.tar.xz | |
| New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\llvm" | Out-Null | |
| 7z x llvm.tar.xz -so | 7z x -si -ttar -o"$env:USERPROFILE\llvm" -aoa | |
| # Move contents up from nested directory | |
| $nested = Get-ChildItem "$env:USERPROFILE\llvm" -Directory | Select-Object -First 1 | |
| if ($nested) { | |
| Get-ChildItem $nested.FullName | Move-Item -Destination "$env:USERPROFILE\llvm" -Force | |
| Remove-Item $nested.FullName -Recurse -Force | |
| } | |
| Remove-Item llvm.tar.xz -Force | |
| - name: Set LLVM prefix (Linux tarball) | |
| if: matrix.llvm_method == 'tarball' && runner.os == 'Linux' | |
| run: echo "LLVM_SYS_211_PREFIX=$HOME/llvm" >> "$GITHUB_ENV" | |
| - name: Set LLVM prefix (Windows tarball) | |
| if: matrix.llvm_method == 'tarball' && runner.os == 'Windows' | |
| shell: pwsh | |
| run: echo "LLVM_SYS_211_PREFIX=$env:USERPROFILE\llvm" >> $env:GITHUB_ENV | |
| # ── musl tools ──────────────────────────────────────────────── | |
| - name: Install musl tools | |
| if: matrix.target == 'x86_64-unknown-linux-musl' | |
| run: sudo apt-get update && sudo apt-get install -y musl-tools | |
| # ── Rust Toolchain ──────────────────────────────────────────── | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Cargo cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: ${{ matrix.target }} | |
| # ── Build ───────────────────────────────────────────────────── | |
| - name: Build meshc | |
| run: cargo build --release --target ${{ matrix.target }} | |
| env: | |
| LLVM_SYS_211_PREFIX: ${{ env.LLVM_SYS_211_PREFIX }} | |
| # ── Strip & Package ─────────────────────────────────────────── | |
| - name: Determine version | |
| id: version | |
| shell: bash | |
| run: | | |
| if [[ "$GITHUB_REF" == refs/tags/v* ]]; then | |
| echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "version=dev" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Strip binary (Unix) | |
| if: runner.os != 'Windows' | |
| run: strip target/${{ matrix.target }}/release/meshc | |
| - name: Package (tar.gz) | |
| if: matrix.archive_ext == 'tar.gz' | |
| run: | | |
| tar czf "meshc-v${{ steps.version.outputs.version }}-${{ matrix.target }}.tar.gz" \ | |
| -C "target/${{ matrix.target }}/release" meshc | |
| - name: Package (zip) | |
| if: matrix.archive_ext == 'zip' | |
| shell: pwsh | |
| run: | | |
| Compress-Archive ` | |
| -Path "target/${{ matrix.target }}/release/meshc.exe" ` | |
| -DestinationPath "meshc-v${{ steps.version.outputs.version }}-${{ matrix.target }}.zip" | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: meshc-${{ matrix.target }} | |
| path: meshc-v${{ steps.version.outputs.version }}-${{ matrix.target }}.${{ matrix.archive_ext }} | |
| # ── Release ───────────────────────────────────────────────────────── | |
| release: | |
| name: Create Release | |
| needs: build | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts/ | |
| merge-multiple: true | |
| - name: Generate SHA256SUMS | |
| run: | | |
| cd artifacts/ | |
| sha256sum *.tar.gz *.zip > SHA256SUMS | |
| cat SHA256SUMS | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: artifacts/* | |
| generate_release_notes: false | |
| draft: false | |
| prerelease: false |