name: release
on:
push:
branches:
- main
jobs:
publish:
name: publish any unpublished packages
runs-on: ubuntu-latest
if: ${{ github.repository_owner == '0xMiden' }}
permissions:
contents: write
outputs:
releases: ${{ steps.publish.outputs.releases }}
releases_created: ${{ steps.publish.outputs.releases_created }}
steps:
- &checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
persist-credentials: false
- &install-rust
name: Install Rust
run: |
rustup update --no-self-update
rustc --version
- name: Publish
id: publish
uses: release-plz/action@v0.5
with:
command: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
upload-artifacts:
name: upload pre-built miden-debug executable artifacts
needs: publish
if: ${{ github.repository_owner == '0xMiden' && needs.publish.outputs.releases_created == 'true' }}
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:
- *checkout
- *install-rust
- name: Add target
run: |
rustup target add ${{ matrix.target }}
- name: Install cargo-make
run: |
if ! cargo make --version 2>/dev/null; then
cargo install cargo-make --force
fi
- name: build
run: |
set -e
cargo make -p production miden-debug --release --target ${{ matrix.target }}
mv target/${{ matrix.target }}/release/miden-debug miden-debug-${{ matrix.target }}
- name: attest
uses: actions/attest-build-provenance@v3
with:
subject-path: "miden-debug-${{ matrix.target }}"
- name: upload
env:
RELEASES: ${{ needs.publish.outputs.releases }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -e
echo "RELEASES:"
echo "=================="
echo "${RELEASES}" | jq -rM
echo "=================="
release_version=$(echo "${RELEASES}" | jq -r '.[0].version')
release_tag=$(echo "${RELEASES}" | jq -r '.[0].tag')
gh release upload ${release_tag} miden-debug-${{ matrix.target }}
release:
name: prepare the next release
runs-on: ubuntu-latest
if: ${{ github.repository_owner == '0xMiden' }}
permissions:
contents: write
pull-requests: write
concurrency:
group: release-plz-${{ github.ref }}
cancel-in-progress: false
steps:
- *checkout
- *install-rust
- name: Create release PR
uses: release-plz/action@v0.5
with:
command: release-pr
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}