diff --git a/.github/workflows/workspace-publish.yml b/.github/workflows/workspace-publish.yml index 09848d751c..ae3764cc73 100644 --- a/.github/workflows/workspace-publish.yml +++ b/.github/workflows/workspace-publish.yml @@ -33,3 +33,55 @@ jobs: verify-main-head: "true" env: CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }} + + # Upload the miden-vm CLI as an artifact on the GitHub release. + # Used by midenup to speed up installs. + upload-artifacts: + name: upload pre-built miden-vm executable artifacts + if: ${{ github.repository_owner == '0xMiden' }} + permissions: + contents: write + id-token: write + attestations: write + strategy: + matrix: + os: [macos-latest, ubuntu-latest] + target: [aarch64-apple-darwin, x86_64-unknown-linux-gnu] + exclude: + - os: macos-latest + target: x86_64-unknown-linux-gnu + - os: ubuntu-latest + target: aarch64-apple-darwin + runs-on: ${{ matrix.os }} + steps: + - name: Checkout repository + uses: actions/checkout@6 + with: + fetch-depth: 0 + ref: ${{ github.event.release.tag_name }} + persist-credentials: false + - uses: ./.github/actions/cleanup-runner + - name: Install Rust + run: | + rustup update --no-self-update + rustc --version + - name: Add target + run: | + rustup target add ${{ matrix.target }} + - name: Build miden-vm + run: | + BUILD_TARGET=${{ matrix.target }} make exec-dist + - name: Prepare artifact + run: | + mv target/${{ matrix.target }}/optimized/miden-vm miden-vm-${{ matrix.target }} + - name: Attest miden-vm + uses: actions/attest-build-provenance@3 + with: + subject-path: miden-vm-${{ matrix.target }} + - name: Upload + env: + RELEASE_TAG: ${{ github.event.release.tag_name }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -e + gh release upload ${RELEASE_TAG} miden-vm-${{ matrix.target }} diff --git a/Makefile b/Makefile index 9832fae841..2359779b30 100644 --- a/Makefile +++ b/Makefile @@ -45,6 +45,9 @@ FEATURES_CONCURRENT_EXEC := --features concurrent,executable FEATURES_METAL_EXEC := --features concurrent,executable,tracing-forest FEATURES_LOG_TREE := --features concurrent,executable,tracing-forest +# Target triple used when producing release artifacts. Defaults to the host's triple. +BUILD_TARGET ?= $(shell rustc -vV | grep host | awk '{print $$2}') + # Per-crate default features FEATURES_air := testing FEATURES_assembly := testing @@ -234,6 +237,10 @@ check-constraints: ## Check core-lib constraint artifacts for drift exec-info: ## Builds an executable with log tree enabled cargo build --profile optimized $(FEATURES_LOG_TREE) +.PHONY: exec-dist +exec-dist: ## Builds the CLI for $(BUILD_TARGET) with --locked (for release artifact uploads) + cargo build --profile optimized $(FEATURES_CONCURRENT_EXEC) --target $(BUILD_TARGET) --locked + # --- examples ------------------------------------------------------------------------------------ .PHONY: run-examples