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: Xodium CI/CD - Plugin | |
| on: | |
| push: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| packages: write | |
| concurrency: | |
| group: "${{ github.workflow }}-${{ github.ref }}" | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: "${{ github.ref_name }}" | |
| steps: | |
| - id: checkout | |
| name: Checkout | |
| uses: actions/checkout@v6.0.2 | |
| - id: setup_rust | |
| name: Setup Rust | |
| uses: actions-rust-lang/setup-rust-toolchain@d197c158264056996cfba74a9c2d93886346edc3 | |
| with: | |
| toolchain: stable | |
| target: wasm32-wasip2 | |
| components: rustfmt, clippy | |
| - id: run_lint | |
| name: Run Lint | |
| run: | | |
| cargo clippy --all-targets --all-features -- -D warnings | |
| cargo fmt --all -- --check | |
| shell: bash | |
| build: | |
| name: Build | |
| needs: [ lint ] | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: "${{ github.ref_name }}" | |
| url: "${{ steps.upload_artifact.outputs.artifact-url }}" | |
| outputs: | |
| VERSION: "${{ steps.get_version.outputs.VERSION }}" | |
| NAME: "${{ steps.get_name.outputs.NAME }}" | |
| steps: | |
| - id: checkout | |
| name: Checkout | |
| uses: actions/checkout@v6.0.2 | |
| - id: cache_dependencies | |
| name: Cache dependencies | |
| uses: actions/cache@v5.0.4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-wasm32-wasip2-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - id: setup_rust | |
| name: Setup Rust | |
| uses: actions-rust-lang/setup-rust-toolchain@d197c158264056996cfba74a9c2d93886346edc3 | |
| with: | |
| toolchain: stable | |
| target: wasm32-wasip2 | |
| - id: build_artifact | |
| name: Build Artefact | |
| run: cargo build --release --target wasm32-wasip2 --timings | |
| shell: bash | |
| - id: get_name | |
| name: Get Name | |
| run: echo "NAME=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].name')" >> $GITHUB_OUTPUT | |
| shell: bash | |
| - id: get_version | |
| name: Get Version | |
| run: | | |
| echo "VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)" >> $GITHUB_OUTPUT | |
| shell: bash | |
| - id: upload_artifact | |
| name: Upload Artifact | |
| uses: actions/upload-artifact@v7.0.0 | |
| with: | |
| name: ${{ steps.get_name.outputs.NAME }}-wasm32-wasip2 | |
| path: target/wasm32-wasip2/release/${{ steps.get_name.outputs.NAME }}.wasm | |
| retention-days: 7 | |
| nightly_release: | |
| name: Nightly Release | |
| needs: [ build ] | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: "${{ github.ref_name }}" | |
| permissions: | |
| contents: write | |
| steps: | |
| - id: checkout | |
| name: Checkout | |
| uses: actions/checkout@v6.0.2 | |
| - id: download_artifacts | |
| name: Download Artefacts | |
| uses: actions/download-artifact@v8.0.1 | |
| with: | |
| pattern: "${{ needs.build.outputs.NAME }}-*" | |
| path: dist/ | |
| merge-multiple: true | |
| - id: update_nightly_tag | |
| name: Update Nightly Tag | |
| run: | | |
| gh api repos/${{ github.repository }}/git/refs/tags/nightly \ | |
| --method PATCH \ | |
| --field sha=${{ github.sha }} \ | |
| --field force=true 2>/dev/null || \ | |
| gh api repos/${{ github.repository }}/git/refs \ | |
| --method POST \ | |
| --field ref=refs/tags/nightly \ | |
| --field sha=${{ github.sha }} | |
| env: | |
| GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
| - id: create_nightly_release | |
| name: Create Nightly Release | |
| uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe | |
| env: | |
| GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
| with: | |
| prerelease: true | |
| files: dist/${{ needs.build.outputs.NAME }}* | |
| tag_name: nightly | |
| name: Nightly Build | |
| body: | | |
| From commit: ${{ github.sha }} | |
| Generated on: ${{ github.event.head_commit.timestamp }} |