|
| 1 | +name: Release CodeGen WASM Plugin |
| 2 | + |
| 3 | +# Manual trigger from the GitHub UI |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + package: |
| 8 | + description: "Package name (e.g., jsoncodegen-java, jsoncodegen-rust)" |
| 9 | + required: true |
| 10 | + type: string |
| 11 | + version: |
| 12 | + description: "Version number (e.g., 1234)" |
| 13 | + required: true |
| 14 | + type: string |
| 15 | + |
| 16 | +jobs: |
| 17 | + build-wasm: |
| 18 | + name: Build WASM (wasm32-wasip1) |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - name: Checkout |
| 22 | + uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Install Rust |
| 25 | + uses: actions-rs/toolchain@v1 |
| 26 | + with: |
| 27 | + toolchain: stable |
| 28 | + |
| 29 | + - name: Add wasm32-wasip1 target |
| 30 | + run: rustup target add wasm32-wasip1 |
| 31 | + |
| 32 | + - name: Build wasm32-wasip1 |
| 33 | + run: cargo build --package ${{ github.event.inputs.package }} --profile cli --target wasm32-wasip1 |
| 34 | + |
| 35 | + - name: Rename binary |
| 36 | + run: | |
| 37 | + mkdir -p artifacts |
| 38 | + cp target/wasm32-wasip1/cli/${{ github.event.inputs.package }}.wasm artifacts/${{ github.event.inputs.package }}-wasm32-wasip1.wasm |
| 39 | +
|
| 40 | + - name: Upload artifact |
| 41 | + uses: actions/upload-artifact@v4 |
| 42 | + with: |
| 43 | + name: ${{ github.event.inputs.package }}-wasm32-wasip1 |
| 44 | + path: artifacts/${{ github.event.inputs.package }}-wasm32-wasip1.wasm |
| 45 | + |
| 46 | + create-release: |
| 47 | + name: Create GitHub Release |
| 48 | + needs: build-wasm |
| 49 | + runs-on: ubuntu-latest |
| 50 | + permissions: |
| 51 | + contents: write |
| 52 | + steps: |
| 53 | + - name: Download artifacts |
| 54 | + uses: actions/download-artifact@v4 |
| 55 | + with: |
| 56 | + name: ${{ github.event.inputs.package }}-wasm32-wasip1 |
| 57 | + path: artifacts |
| 58 | + |
| 59 | + - name: Create Release |
| 60 | + uses: softprops/action-gh-release@v1 |
| 61 | + with: |
| 62 | + tag_name: ${{ github.event.inputs.package }}-wasm32-wasip1-${{ github.event.inputs.version }} |
| 63 | + name: ${{ github.event.inputs.package }} WASM ${{ github.event.inputs.version }} |
| 64 | + draft: false |
| 65 | + prerelease: false |
| 66 | + files: artifacts/${{ github.event.inputs.package }}-wasm32-wasip1.wasm |
| 67 | + env: |
| 68 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments