Skip to content

chore: release v0.3.7 #28

chore: release v0.3.7

chore: release v0.3.7 #28

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
permissions: {}
jobs:
publish-crates:
name: Publish Rust crates
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
- name: Publish srcmap-codec
run: cargo publish -p srcmap-codec || echo "Already published, skipping"
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Wait for crates.io index
run: sleep 30
- name: Publish srcmap-scopes
run: cargo publish -p srcmap-scopes || echo "Already published, skipping"
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Wait for crates.io index
run: sleep 30
- name: Publish srcmap-sourcemap
run: cargo publish -p srcmap-sourcemap || echo "Already published, skipping"
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Wait for crates.io index
run: sleep 30
- name: Publish srcmap-symbolicate
run: cargo publish -p srcmap-symbolicate || echo "Already published, skipping"
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Publish srcmap-generator
run: cargo publish -p srcmap-generator || echo "Already published, skipping"
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Wait for crates.io index
run: sleep 30
- name: Publish srcmap-hermes
run: cargo publish -p srcmap-hermes || echo "Already published, skipping"
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Publish srcmap-ram-bundle
run: cargo publish -p srcmap-ram-bundle || echo "Already published, skipping"
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Publish srcmap-remapping
run: cargo publish -p srcmap-remapping || echo "Already published, skipping"
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Publish srcmap-cli
run: cargo publish -p srcmap-cli || echo "Already published, skipping"
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
build-napi:
name: Build NAPI - ${{ matrix.settings.target }}
runs-on: ${{ matrix.settings.host }}
permissions:
contents: read
strategy:
fail-fast: false
matrix:
settings:
- host: macos-latest
target: x86_64-apple-darwin
- host: macos-latest
target: aarch64-apple-darwin
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
- host: ubuntu-latest
target: x86_64-unknown-linux-musl
- host: ubuntu-latest
target: aarch64-unknown-linux-gnu
linker: aarch64-linux-gnu-gcc
- host: ubuntu-latest
target: aarch64-unknown-linux-musl
linker: aarch64-linux-gnu-gcc
- host: windows-latest
target: x86_64-pc-windows-msvc
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: 24
registry-url: https://registry.npmjs.org/
- uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7
with:
targets: ${{ matrix.settings.target }}
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
- name: Install musl tools
if: contains(matrix.settings.target, 'musl')
run: |
sudo apt-get update
sudo apt-get install -y musl-tools
- name: Install aarch64 cross-compilation tools
if: matrix.settings.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- name: Install aarch64 musl cross-compilation tools
if: matrix.settings.target == 'aarch64-unknown-linux-musl'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu musl-tools
- name: Install @napi-rs/cli
run: npm install -g @napi-rs/cli
- name: Build codec NAPI binary
run: |
cd packages/codec
napi build --release --platform --target ${{ matrix.settings.target }}
shell: bash
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: ${{ matrix.settings.linker || '' }}
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: ${{ matrix.settings.linker || '' }}
- name: Build sourcemap NAPI binary
run: |
cd packages/sourcemap
napi build --release --platform --target ${{ matrix.settings.target }}
shell: bash
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: ${{ matrix.settings.linker || '' }}
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: ${{ matrix.settings.linker || '' }}
- name: Upload codec artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: codec-bindings-${{ matrix.settings.target }}
path: packages/codec/*.node
if-no-files-found: error
- name: Upload sourcemap artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: sourcemap-bindings-${{ matrix.settings.target }}
path: packages/sourcemap/*.node
if-no-files-found: error
build-wasm:
name: Build WASM
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7
with:
targets: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
- name: Install wasm-pack
shell: bash
run: |
set -euo pipefail
install_script='https://rustwasm.github.io/wasm-pack/installer/init.sh'
for attempt in 1 2 3; do
if curl "$install_script" -sSf | sh; then
exit 0
fi
echo "wasm-pack installer attempt $attempt failed; retrying..." >&2
sleep 5
done
cargo install wasm-pack --locked --version 0.13.1
- name: Build sourcemap-wasm (nodejs)
run: wasm-pack build --target nodejs --out-dir pkg --release
working-directory: packages/sourcemap-wasm
- name: Build sourcemap-wasm (web)
run: wasm-pack build --target web --out-dir web --release
working-directory: packages/sourcemap-wasm
- name: Build generator-wasm (nodejs)
run: wasm-pack build --target nodejs --out-dir pkg --release
working-directory: packages/generator-wasm
- name: Build generator-wasm (web)
run: wasm-pack build --target web --out-dir web --release
working-directory: packages/generator-wasm
- name: Build remapping-wasm (nodejs)
run: wasm-pack build --target nodejs --out-dir pkg --release
working-directory: packages/remapping-wasm
- name: Build remapping-wasm (web)
run: wasm-pack build --target web --out-dir web --release
working-directory: packages/remapping-wasm
- name: Build symbolicate-wasm (nodejs)
run: wasm-pack build --target nodejs --out-dir pkg --release
working-directory: packages/symbolicate-wasm
- name: Build symbolicate-wasm (web)
run: wasm-pack build --target web --out-dir web --release
working-directory: packages/symbolicate-wasm
- name: Remove wasm-pack .gitignore files
run: |
rm -f packages/sourcemap-wasm/pkg/.gitignore packages/sourcemap-wasm/web/.gitignore
rm -f packages/generator-wasm/pkg/.gitignore packages/generator-wasm/web/.gitignore
rm -f packages/remapping-wasm/pkg/.gitignore packages/remapping-wasm/web/.gitignore
rm -f packages/symbolicate-wasm/pkg/.gitignore packages/symbolicate-wasm/web/.gitignore
- name: Upload sourcemap-wasm pkg artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: wasm-sourcemap-package
path: packages/sourcemap-wasm/pkg/
if-no-files-found: error
- name: Upload sourcemap-wasm web artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: wasm-sourcemap-web
path: packages/sourcemap-wasm/web/
if-no-files-found: error
- name: Upload generator-wasm pkg artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: wasm-generator-package
path: packages/generator-wasm/pkg/
if-no-files-found: error
- name: Upload generator-wasm web artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: wasm-generator-web
path: packages/generator-wasm/web/
if-no-files-found: error
- name: Upload remapping-wasm pkg artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: wasm-remapping-package
path: packages/remapping-wasm/pkg/
if-no-files-found: error
- name: Upload remapping-wasm web artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: wasm-remapping-web
path: packages/remapping-wasm/web/
if-no-files-found: error
- name: Upload symbolicate-wasm pkg artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: wasm-symbolicate-package
path: packages/symbolicate-wasm/pkg/
if-no-files-found: error
- name: Upload symbolicate-wasm web artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: wasm-symbolicate-web
path: packages/symbolicate-wasm/web/
if-no-files-found: error
publish-npm:
name: Publish npm packages
runs-on: ubuntu-latest
needs: [build-napi, build-wasm]
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: 24
registry-url: https://registry.npmjs.org/
- name: Ensure latest npm (for trusted publishing)
run: npm install -g npm@10.9.8 && npm install -g npm@latest
- name: Configure npm registry
run: npm config set registry https://registry.npmjs.org/
- name: Install @napi-rs/cli
run: npm install -g @napi-rs/cli
- name: Prepare publish helper
shell: bash
run: |
cat > /tmp/publish-if-needed.sh <<'EOF'
#!/usr/bin/env bash
set -euo pipefail
pkg_dir="$1"
cd "$pkg_dir"
name="$(node -p "require('./package.json').name")"
version="$(node -p "require('./package.json').version")"
if npm view "${name}@${version}" version >/dev/null 2>&1; then
echo "Skipping ${name}@${version}; already present on npm"
exit 0
fi
if ! npm publish --access public --provenance --ignore-scripts; then
echo "Provenance publish failed for ${name}@${version}, retrying without provenance..."
npm publish --access public --ignore-scripts
fi
EOF
chmod +x /tmp/publish-if-needed.sh
- name: Download all codec NAPI artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
path: packages/codec/artifacts
pattern: codec-bindings-*
merge-multiple: false
- name: Download all sourcemap NAPI artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
path: packages/sourcemap/artifacts
pattern: sourcemap-bindings-*
merge-multiple: false
- name: Download sourcemap-wasm pkg artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: wasm-sourcemap-package
path: packages/sourcemap-wasm/pkg
- name: Download sourcemap-wasm web artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: wasm-sourcemap-web
path: packages/sourcemap-wasm/web
- name: Download generator-wasm pkg artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: wasm-generator-package
path: packages/generator-wasm/pkg
- name: Download generator-wasm web artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: wasm-generator-web
path: packages/generator-wasm/web
- name: Download remapping-wasm pkg artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: wasm-remapping-package
path: packages/remapping-wasm/pkg
- name: Download remapping-wasm web artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: wasm-remapping-web
path: packages/remapping-wasm/web
- name: Download symbolicate-wasm pkg artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: wasm-symbolicate-package
path: packages/symbolicate-wasm/pkg
- name: Download symbolicate-wasm web artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: wasm-symbolicate-web
path: packages/symbolicate-wasm/web
- name: Move codec artifacts
run: napi artifacts -d artifacts
working-directory: packages/codec
- name: Move sourcemap artifacts
run: napi artifacts -d artifacts
working-directory: packages/sourcemap
- name: Publish @srcmap/codec platform packages
shell: bash
run: |
failed=0
for dir in npm/*/; do
name="$(node -p "require('./${dir%/}/package.json').name")"
version="$(node -p "require('./${dir%/}/package.json').version")"
if npm view "${name}@${version}" version >/dev/null 2>&1; then
echo "Skipping ${name}@${version}; already present on npm"
continue
fi
if ! npm publish "$dir" --access public --provenance; then
echo "Provenance publish failed for ${name}@${version}, retrying without provenance..."
if ! npm publish "$dir" --access public; then
echo "::error::Failed to publish ${name}@${version}"
failed=1
fi
fi
done
if [ "$failed" -eq 1 ]; then
exit 1
fi
working-directory: packages/codec
- name: Publish @srcmap/codec
run: /tmp/publish-if-needed.sh .
working-directory: packages/codec
- name: Publish @srcmap/sourcemap platform packages
shell: bash
run: |
failed=0
for dir in npm/*/; do
name="$(node -p "require('./${dir%/}/package.json').name")"
version="$(node -p "require('./${dir%/}/package.json').version")"
if npm view "${name}@${version}" version >/dev/null 2>&1; then
echo "Skipping ${name}@${version}; already present on npm"
continue
fi
if ! npm publish "$dir" --access public --provenance; then
echo "Provenance publish failed for ${name}@${version}, retrying without provenance..."
if ! npm publish "$dir" --access public; then
echo "::error::Failed to publish ${name}@${version}"
failed=1
fi
fi
done
if [ "$failed" -eq 1 ]; then
exit 1
fi
working-directory: packages/sourcemap
- name: Publish @srcmap/sourcemap
run: /tmp/publish-if-needed.sh .
working-directory: packages/sourcemap
- name: Publish @srcmap/sourcemap-wasm
run: /tmp/publish-if-needed.sh .
working-directory: packages/sourcemap-wasm
- name: Publish @srcmap/generator-wasm
run: /tmp/publish-if-needed.sh .
working-directory: packages/generator-wasm
- name: Publish @srcmap/source-map
run: /tmp/publish-if-needed.sh .
working-directory: packages/source-map
- name: Publish @srcmap/gen-mapping
run: /tmp/publish-if-needed.sh .
working-directory: packages/gen-mapping
- name: Publish @srcmap/remapping-wasm
run: /tmp/publish-if-needed.sh .
working-directory: packages/remapping-wasm
- name: Publish @srcmap/remapping
run: /tmp/publish-if-needed.sh .
working-directory: packages/remapping
- name: Publish @srcmap/symbolicate-wasm
run: /tmp/publish-if-needed.sh .
working-directory: packages/symbolicate-wasm
- name: Publish @srcmap/trace-mapping
run: /tmp/publish-if-needed.sh .
working-directory: packages/trace-mapping