name: Release Assets
on:
release:
types: [created]
permissions:
contents: write
jobs:
build-and-release:
runs-on: ubuntu-latest
strategy:
matrix:
build: [
{ name: 'standard', features: '' },
{ name: 'llm', features: '--no-default-features --features llm' },
{ name: 'fetch', features: '--no-default-features --features fetch' },
{ name: 'crypto', features: '--no-default-features --features crypto' },
{ name: 'crawl', features: '--no-default-features --features crawl' },
{ name: 'wasip1', features: '--no-default-features --features wasip1' },
{ name: 'full', features: '--all-features' }
]
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@1.84.0
with:
targets: wasm32-wasip1
- name: Install javy-cli
run: |
JAVY_VERSION=$(curl -s https://api.github.com/repos/bytecodealliance/javy/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
curl -L "https://github.com/bytecodealliance/javy/releases/download/${JAVY_VERSION}/javy-x86_64-linux-v${JAVY_VERSION#v}.gz" -o javy.gz
gunzip javy.gz
chmod +x javy
sudo mv javy /usr/local/bin/
- name: Build ${{ matrix.build.name }}
run: |
cargo build --target=wasm32-wasip1 --release ${{ matrix.build.features }}
javy init-plugin ./target/wasm32-wasip1/release/bless_plugins.wasm -o bless_plugins.wasm
- name: Prepare versioned artifact
id: prepare
run: |
VERSION=${{ github.event.release.tag_name }}
SUFFIX="${{ matrix.build.name != 'standard' && format('-{0}', matrix.build.name) || '' }}"
ARTIFACT_NAME="bless-plugins${SUFFIX}-${VERSION}.wasm"
mv bless_plugins.wasm "$ARTIFACT_NAME"
echo "artifact_name=$ARTIFACT_NAME" >> "$GITHUB_OUTPUT"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bless-plugins-wasm-${{ matrix.build.name }}
path: ${{ steps.prepare.outputs.artifact_name }}
retention-days: 1
- name: Upload Release Asset
run: |
gh release upload ${{ github.event.release.tag_name }} ${{ steps.prepare.outputs.artifact_name }} --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}