1313 required : false
1414 default : true
1515 type : boolean
16+ publish_crate_nexis_wasm_plugin :
17+ description : " Publish nexis_wasm_plugin crate to crates.io"
18+ required : false
19+ default : true
20+ type : boolean
1621 publish_images :
1722 description : " Build and publish Docker images to GHCR"
1823 required : false
3136 runs-on : ubuntu-latest
3237 outputs :
3338 sdk_ts : ${{ steps.set.outputs.sdk_ts }}
39+ crate_nexis_wasm_plugin : ${{ steps.set.outputs.crate_nexis_wasm_plugin }}
3440 image_rust_server : ${{ steps.set.outputs.image_rust_server }}
3541 image_control_api : ${{ steps.set.outputs.image_control_api }}
3642 image_dashboard_ui : ${{ steps.set.outputs.image_dashboard_ui }}
4551 filters : |
4652 sdk_ts:
4753 - 'sdks/ts/**'
54+ crate_nexis_wasm_plugin:
55+ - 'plugins/rust/nexis_wasm_plugin/**'
4856 image_rust_server:
4957 - 'server/**'
5058 - 'plugins/**'
@@ -60,12 +68,14 @@ jobs:
6068 run : |
6169 if [[ "${GITHUB_REF}" == refs/tags/v* ]] || [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then
6270 sdk_ts=true
71+ crate_nexis_wasm_plugin=true
6372 image_rust_server=true
6473 image_control_api=true
6574 image_dashboard_ui=true
6675 image_web_demo=true
6776 else
6877 sdk_ts="${{ steps.filter.outputs.sdk_ts }}"
78+ crate_nexis_wasm_plugin="${{ steps.filter.outputs.crate_nexis_wasm_plugin }}"
6979 image_rust_server="${{ steps.filter.outputs.image_rust_server }}"
7080 image_control_api="${{ steps.filter.outputs.image_control_api }}"
7181 image_dashboard_ui="${{ steps.filter.outputs.image_dashboard_ui }}"
7888 fi
7989
8090 echo "sdk_ts=${sdk_ts}" >> "$GITHUB_OUTPUT"
91+ echo "crate_nexis_wasm_plugin=${crate_nexis_wasm_plugin}" >> "$GITHUB_OUTPUT"
8192 echo "image_rust_server=${image_rust_server}" >> "$GITHUB_OUTPUT"
8293 echo "image_control_api=${image_control_api}" >> "$GITHUB_OUTPUT"
8394 echo "image_dashboard_ui=${image_dashboard_ui}" >> "$GITHUB_OUTPUT"
@@ -388,6 +399,46 @@ jobs:
388399 working-directory : sdks/ts
389400 run : npm publish --access public --provenance --tag ${{ steps.npm_tag.outputs.tag }}
390401
402+ publish-crate-nexis-wasm-plugin :
403+ needs : [changes, validate]
404+ if : startsWith(github.ref, 'refs/tags/v') && (github.event_name == 'push' || inputs.publish_crate_nexis_wasm_plugin == true) && needs.changes.outputs.crate_nexis_wasm_plugin == 'true'
405+ runs-on : ubuntu-latest
406+ permissions :
407+ contents : read
408+ id-token : write
409+ environment : release
410+ steps :
411+ - uses : actions/checkout@v4
412+ - uses : dtolnay/rust-toolchain@1.89.0
413+ - name : Read crate version
414+ id : crate
415+ shell : bash
416+ run : |
417+ version="$(grep -m1 '^version = ' plugins/rust/nexis_wasm_plugin/Cargo.toml | sed -E 's/version = \"([^\"]+)\"/\1/')"
418+ echo "version=${version}" >> "$GITHUB_OUTPUT"
419+ - name : Check if crate version already exists on crates.io
420+ id : exists
421+ shell : bash
422+ run : |
423+ if curl -fsS "https://crates.io/api/v1/crates/nexis_wasm_plugin/${{ steps.crate.outputs.version }}" > /dev/null; then
424+ echo "already_published=true" >> "$GITHUB_OUTPUT"
425+ echo "nexis_wasm_plugin@${{ steps.crate.outputs.version }} is already published."
426+ else
427+ echo "already_published=false" >> "$GITHUB_OUTPUT"
428+ fi
429+ - name : Dry-run publish
430+ if : steps.exists.outputs.already_published != 'true'
431+ run : cargo publish --dry-run --locked --manifest-path plugins/rust/nexis_wasm_plugin/Cargo.toml
432+ - name : Authenticate with crates.io (trusted publishing)
433+ if : steps.exists.outputs.already_published != 'true'
434+ id : auth
435+ uses : rust-lang/crates-io-auth-action@v1
436+ - name : Publish crate to crates.io
437+ if : steps.exists.outputs.already_published != 'true'
438+ env :
439+ CARGO_REGISTRY_TOKEN : ${{ steps.auth.outputs.token }}
440+ run : cargo publish --locked --manifest-path plugins/rust/nexis_wasm_plugin/Cargo.toml
441+
391442 build-rust-server-binary :
392443 needs : validate
393444 if : startsWith(github.ref, 'refs/tags/v')
0 commit comments