Source: .github/actions/corprus-crucible/action.yml · composite action
Build a release binary, sign it, archive it, scan it and stage publication artifacts.
Intended for: Platform build jobs in rustGlobalBuild; this action does not run tests. With lint it runs Clippy on the build as released first, for targets no test job compiles.
Release behavior#
Non-PR: validate token, build, check the binary needs nothing of the build machine, keyless Cosign sign binary, create zip, scan, stage. PR: build, check, and upload a workflow artifact. Final GitHub/Nexus publishing belongs to later workflow jobs.
Artifacts and effects#
- Release binary
- Cosign bundle included with the zip
- Staged GitHub/Nexus workflow artifacts
Assumptions and permissions#
- Quality checks run in the reusable workflow alongside this action; nothing it stages is published unless they pass.
- contents/id-token write are needed by release jobs; vt_api_key is required outside PRs.
- Platform overrides select archive names/target; cargo_package controls root-workspace selection. Pull requests restore the default branch's caches.
Failure modes#
- Build context/manifest confusion: inspect resolve-build-context.sh and build-release-binary.sh.
- Missing include_files or archiver: inspect create-release-archive.sh.
- OIDC/signing or scan failures: inspect sign-release-binary.sh and format-virustotal-links.sh.
Example#
Use rustGlobalBuild rather than bypassing its quality gates. The action's inputs and ordered steps are generated below.
Inputs#
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
binary_name | — | true | — | Name of the binary (without platform suffix) |
cargo_package | — | false | Optional Cargo package that provides the binary, built from the repository root with --package <name> --bin <binary_name>. workspace builds with --workspace --bin <binary_name> instead. Empty keeps directory detection. | |
development_release | — | false | development | The rolling pre-release default-branch pushes refresh: release_name is a development build when it is this. |
include_files | — | false | README.md,LICENSE | Additional files or directories to include in archives (comma-separated) |
lint | — | false | false | Run Clippy on the build as released (its target and features) before building. For targets no test job compiles, such as Android and PortMaster. |
nexus_api_key | — | false | Nexus Mods API key. Provide with nexus_group_ids to upload release archives to Nexus Mods. | |
nexus_group_ids | — | false | Nexus Mods file group IDs as JSON. Provide with nexus_api_key to upload release archives to Nexus Mods. | |
platform_arch | — | false | Release platform architecture used for artifacts. Defaults to the runner architecture for native builds. | |
platform_os | — | false | Release platform name used for artifacts. Defaults to the runner OS for native builds. | |
release_name | — | true | — | Name of the release (tag or development) |
rust_target | — | false | Optional Rust target triple for cross-compiled release builds. | |
vt_api_key | — | true | — | VirusTotal API key (REQUIRED) |
Permissions#
Top-level: —. Undeclared means inherited from the caller, not "none needed".
Steps#
Composite action#
| Step | Action / command | Condition |
|---|---|---|
| Validate VirusTotal API Key | bash "${{ github.action_path }}/../../../scripts/corprus-crucible/validate-virustotal-key.sh" "${{ inputs.vt_api_key }}" | github.event_name != 'pull_request' |
| Determine Binary Suffix | bash "${{ github.action_path }}/../../../scripts/corprus-crucible/binary-suffix.sh" "${{ inputs.platform_os || runner.os }}" | — |
| Determine Build Context | bash "${{ github.action_path }}/../../../scripts/corprus-crucible/resolve-build-context.sh" "${{ inputs.binary_name }}" "${{ inputs.cargo_package }}" | — |
| Setup Rust | dtolnay/rust-toolchain@stable | — |
| Setup LLVM | bash "${{ github.action_path }}/../../../scripts/shared/setup-llvm.sh" "" "" | — |
| Name the target cache's partition | bash "${{ github.action_path }}/../../../scripts/shared/cache-partition.sh" | — |
| Setup Rust Target | rustup target add "${{ inputs.rust_target }}" | inputs.rust_target != '' |
| ⚡ Cache the downloaded crates | actions/cache@v5.0.5 | github.event_name != 'pull_request' |
| ⚡ Restore the downloaded crates | actions/cache/restore@v5.0.5 | github.event_name == 'pull_request' |
| ⚡ Restore Cargo target cache | actions/cache/restore@v5.0.5 | — |
| Lint the build as released | bash "${{ github.action_path }}/../../../scripts/corprus-crucible/clippy-release.sh" '["${{ inputs.binary_name }}"]' "${{ inputs.cargo_package }}" "${{ inputs.platform_os || runner.os }}" "${{ inputs.platform_arch || runner.arch }}" "${{ inputs.rust_target }}" "${{ steps.context.outputs.target_dir }}" | inputs.lint == 'true' |
| Build Release | bash "${{ github.action_path }}/../../../scripts/corprus-crucible/build-release-binary.sh" "${{ inputs.binary_name }}" "${{ steps.os_check.outputs.suffix }}" "${{ steps.context.outputs.build_dir }}" "${{ steps.context.outputs.target_dir }}" "${{ steps.context.outputs.dist_dir }}" "${{ inputs.rust_target }}" "${{ inputs.platform_os || runner.os }}" "${{ inputs.platform_arch || runner.arch }}" "${{ inputs.cargo_package }}" | — |
| Check the binary needs nothing of the build machine | bash "${{ github.action_path }}/../../../scripts/corprus-crucible/check-release-binary.sh" "${{ steps.build_release.outputs.release_binary }}" "${{ inputs.platform_os || runner.os }}" | — |
| ⚡ Save Cargo target cache | actions/cache/save@v5.0.5 | github.event_name != 'pull_request' && steps.cache_release_target.outputs.cache-hit != 'true' |
| Install Cosign | sigstore/cosign-installer@faadad0cce49287aee09b3a48701e75088a2c6ad | github.event_name != 'pull_request' |
| Sign Binary | bash "${{ github.action_path }}/../../../scripts/corprus-crucible/sign-release-binary.sh" "${{ steps.build_release.outputs.release_binary }}" "${{ steps.context.outputs.dist_dir }}/${{ inputs.binary_name }}-${{ inputs.platform_os || runner.os }}-${{ inputs.platform_arch || runner.arch }}.bundle" | github.event_name != 'pull_request' |
| Create Archive | bash "${{ github.action_path }}/../../../scripts/corprus-crucible/create-release-archive.sh" "${{ inputs.binary_name }}" "${{ inputs.platform_os || runner.os }}" "${{ inputs.platform_arch || runner.arch }}" "${{ steps.build_release.outputs.binary_name }}" "${{ steps.context.outputs.build_dir }}" "${{ steps.context.outputs.dist_dir }}" "${{ inputs.include_files }}" | github.event_name != 'pull_request' |
| VirusTotal Scan | crazy-max/ghaction-virustotal@v5 | github.event_name != 'pull_request' |
| Format VirusTotal Links | bash "${{ github.action_path }}/../../../scripts/corprus-crucible/format-virustotal-links.sh" "${{ inputs.binary_name }}-${{ inputs.platform_os || runner.os }}-${{ inputs.platform_arch || runner.arch }}" "${{ steps.vt_scan.outputs.analysis }}" | github.event_name != 'pull_request' |
| Validate Nexus Mods Inputs | bash "${{ github.action_path }}/../../../scripts/corprus-crucible/validate-nexusmods-inputs.sh" "${{ inputs.nexus_api_key }}" | github.event_name != 'pull_request' && (inputs.nexus_api_key != '' || inputs.nexus_group_ids != '') |
| Resolve Nexus Mods Group ID | bash "${{ github.action_path }}/../../../scripts/corprus-crucible/resolve-nexusmods-group-id.sh" "$PLATFORM_OS" "$PLATFORM_ARCH" "$RELEASE_NAME" | github.event_name != 'pull_request' && inputs.nexus_api_key != '' && inputs.nexus_group_ids != '' |
| Prepare Nexus Mods Archive | bash "${{ github.action_path }}/../../../scripts/corprus-crucible/prepare-nexusmods-archive.sh" "$BINARY_NAME" "$PLATFORM_OS" "$PLATFORM_ARCH" "$NEXUS_PLATFORM" "$RELEASE_NAME" | github.event_name != 'pull_request' && inputs.nexus_api_key != '' && steps.nexus_group.outputs.group_id != '' |
| Prepare Nexus Mods Upload Artifact | bash "${{ github.action_path }}/../../../scripts/corprus-crucible/prepare-nexusmods-upload-artifact.sh" "$BINARY_NAME" "$PLATFORM_OS" "$PLATFORM_ARCH" "$NEXUS_GROUP_ID" "$NEXUS_ARCHIVE" "$NEXUS_FILE_STEM" "$RELEASE_NAME" "$REPOSITORY" | github.event_name != 'pull_request' && inputs.nexus_api_key != '' && steps.nexus_group.outputs.group_id != '' |
| Upload Nexus Mods Upload Artifact | actions/upload-artifact@v7.0.1 | github.event_name != 'pull_request' && inputs.nexus_api_key != '' && steps.nexus_group.outputs.group_id != '' |
| Prepare GitHub Release Artifact | bash "${{ github.action_path }}/../../../scripts/corprus-crucible/prepare-github-release-artifact.sh" "${{ inputs.binary_name }}" "${{ inputs.platform_os || runner.os }}" "${{ inputs.platform_arch || runner.arch }}" "${{ inputs.binary_name }}-${{ inputs.platform_os || runner.os }}-${{ inputs.platform_arch || runner.arch }}.zip" | github.event_name != 'pull_request' |
| Upload GitHub Release Artifact | actions/upload-artifact@v7.0.1 | github.event_name != 'pull_request' |
| Upload artifact (for PRs) | actions/upload-artifact@v7.0.1 | github.event_name == 'pull_request' |