v0.3.2: Fix duplicate import maps, index.html path resolution, auto-i… #36
Workflow file for this run
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: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to release (e.g. 0.2.9)' | |
| required: true | |
| type: string | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| # ── Build native binaries for all platforms ─────────────────────────── | |
| build: | |
| name: Build ${{ matrix.target }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| zig-target: x86_64-linux-gnu | |
| archive: tar.gz | |
| binary: pledge | |
| - os: ubuntu-latest | |
| target: aarch64-unknown-linux-gnu | |
| zig-target: aarch64-linux-gnu | |
| archive: tar.gz | |
| binary: pledge | |
| cross: true | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| zig-target: x86_64-macos | |
| archive: tar.gz | |
| binary: pledge | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| zig-target: aarch64-macos | |
| archive: tar.gz | |
| binary: pledge | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| zig-target: x86_64-windows-msvc | |
| archive: zip | |
| binary: pledge.exe | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install Zig | |
| uses: mlugg/setup-zig@v2 | |
| with: | |
| version: 0.16.0 | |
| - name: Install cross-compilation tools (aarch64-linux) | |
| if: matrix.cross == true | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-aarch64-linux-gnu | |
| - name: Build native library (Zig) | |
| run: zig build -Doptimize=ReleaseFast -Dtarget=${{ matrix.zig-target }} | |
| - name: Cache cargo | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: release-${{ matrix.target }}-v2 | |
| - name: Build release binary | |
| run: cargo build --release --target ${{ matrix.target }} -p pledgepack-cli | |
| env: | |
| CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: ${{ matrix.cross == true && 'aarch64-linux-gnu-gcc' || '' }} | |
| - name: Package binary (Unix) | |
| if: matrix.archive == 'tar.gz' | |
| run: | | |
| cd target/${{ matrix.target }}/release | |
| tar czf ../../../pledge-${{ matrix.target }}.tar.gz ${{ matrix.binary }} | |
| - name: Package binary (Windows) | |
| if: matrix.archive == 'zip' | |
| shell: pwsh | |
| run: | | |
| Compress-Archive -Path "target/${{ matrix.target }}/release/${{ matrix.binary }}" -DestinationPath "pledge-${{ matrix.target }}.zip" | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pledge-${{ matrix.target }} | |
| path: pledge-${{ matrix.target }}.${{ matrix.archive }} | |
| retention-days: 30 | |
| # ── Create GitHub Release with all binaries ─────────────────────────── | |
| github-release: | |
| name: GitHub Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Determine version | |
| id: version | |
| run: | | |
| if [ -n "${{ inputs.version }}" ]; then | |
| echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT | |
| echo "tag=v${{ inputs.version }}" >> $GITHUB_OUTPUT | |
| else | |
| TAG="${GITHUB_REF#refs/tags/}" | |
| echo "version=${TAG#v}" >> $GITHUB_OUTPUT | |
| echo "tag=$TAG" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v5 | |
| with: | |
| path: artifacts | |
| merge-multiple: true | |
| - name: List artifacts | |
| run: ls -la artifacts/ | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.version.outputs.tag }} | |
| name: v${{ steps.version.outputs.version }} | |
| draft: false | |
| prerelease: ${{ contains(steps.version.outputs.version, '-') }} | |
| generate_release_notes: true | |
| files: artifacts/* | |
| body: | | |
| ## PledgePack v${{ steps.version.outputs.version }} | |
| ### Installation | |
| ```bash | |
| npm install -g pledgepack | |
| ``` | |
| Or download the binary for your platform directly from the assets below. | |
| ### Platforms | |
| - `x86_64-unknown-linux-gnu` — Linux x64 | |
| - `aarch64-unknown-linux-gnu` — Linux ARM64 | |
| - `x86_64-apple-darwin` — macOS Intel | |
| - `aarch64-apple-darwin` — macOS Apple Silicon | |
| - `x86_64-pc-windows-msvc` — Windows x64 | |
| ### Verify | |
| ```bash | |
| pledge --version | |
| ``` | |
| # ── Publish to npm ──────────────────────────────────────────────────── | |
| npm-publish: | |
| name: Publish to npm | |
| needs: github-release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: 22 | |
| registry-url: https://registry.npmjs.org | |
| - name: Verify package.json version matches tag | |
| run: | | |
| TAG="${GITHUB_REF#refs/tags/}" | |
| TAG_VERSION="${TAG#v}" | |
| PKG_VERSION=$(node -p "require('./package.json').version") | |
| if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then | |
| echo "ERROR: Tag version ($TAG_VERSION) does not match package.json version ($PKG_VERSION)" | |
| exit 1 | |
| fi | |
| echo "Version verified: $PKG_VERSION" | |
| - name: npm publish | |
| run: npm publish --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |