Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 105 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,123 @@
# Runs `release-plz release` only after the release PR (starts with `release-plz-`)
# is merged to the next branch. See `release_always = false` in `release-plz.toml`
# Publishes any unpublished crates when.
# Does nothing if all crates are already published (i.e. have their versions on crates.io).
# Does not create/update release PRs.
# The crate version bumping and changelog generation is done via the `release-plz update` CLI command.
# Then manually create a release PR(starts with `release-plz-`) with the proposed changes and
# when the PR is merged this action will publish the crates.
# See CONTRIBUTING.md for more details.

name: release-plz
# Our release workflow is as follows:
#
# 1. Merging to `main` will create a new release PR containing any unreleased changes
# 2. The release PR gets merged to `main` when we are ready to publish the release
# 3. The crates are published to crates.io, a new git tag is created, as well as a GitHub release
# 4. A job is run to pre-build the executable for our supported targets and upload them to the
# release.
name: release

on:
push:
branches:
- next
- main

jobs:
release-plz:
name: release-plz
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:
- uses: actions/checkout@v5
- name: Install Rust
- &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:
# Only run the `release` command that publishes any unpublished crates.
command: release
# `manifest_path` is omitted because it defaults to the root directory
# manifest_path: "..."
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

upload-artifacts:
name: upload pre-built midenc executable artifacts
runs-on: ubuntu-latest
needs: publish
if: ${{ github.repository_owner == '0xMiden' && needs.publish.outputs.releases_created == 'true' }}
permissions:
contents: write
strategy:
matrix:
target: [aarch64-apple-darwin, x86_64-unknown-linux-gnu]
steps:
- *checkout
- *install-rust
- name: Determine midenc release tag
id: midenc-release
env:
RELEASES: ${{ needs.publish.outputs.releases }}
run: |
set -eo pipefail
echo "RELEASES:"
echo "=================="
echo "${RELEASES}" | jq -rM
echo "=================="
release_tag=$(echo "${RELEASES}" | jq -r '.[] | select(.package_name == "midenc" or .package_name == "cargo-miden") | .tag' | head -n1)
if [ -z "${release_tag}" ] || [ "${release_tag}" = "null" ]; then
echo "midenc or cargo-miden crate was not released in this run. Skipping artifact upload."
echo "release_tag=" >> "${GITHUB_OUTPUT}"
exit 0
fi
echo "release_tag=${release_tag}" >> "${GITHUB_OUTPUT}"
- name: Add target
if: ${{ steps.midenc-release.outputs.release_tag != '' }}
run: |
rustup target add ${{ matrix.target }}
- name: Install cargo-make
if: ${{ steps.midenc-release.outputs.release_tag != '' }}
run: |
if ! cargo make --version 2>/dev/null; then
cargo install cargo-make --force
fi
- name: build binaries
if: ${{ steps.midenc-release.outputs.release_tag != '' }}
run: |
set -e
ARGS="--release --target ${{ matrix.target }}"
cargo make --profile production midenc ${ARGS}
cargo make --profile production cargo-miden ${ARGS}
- name: upload
if: ${{ steps.midenc-release.outputs.release_tag != '' }}
env:
RELEASE_TAG: ${{ steps.midenc-release.outputs.release_tag }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -e
mv bin/midenc midenc-${{ matrix.target }}
gh release upload ${RELEASE_TAG} midenc-${{ matrix.target }}
mv bin/cargo-miden cargo-miden-${{ matrix.target }}
gh release upload ${RELEASE_TAG} cargo-miden-${{ 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 }}
22 changes: 13 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@ TBD

## Release Process

### Prerequisites
### Release of the Miden Compiler

Install `release-plz` CLI tool following the instructions [here](https://release-plz.ieni.dev/docs/usage/installation)
Install `cargo-semver-checks` CLI tool [here](https://github.com/obi1kenobi/cargo-semver-checks#installation) to use as an extra check in `release-plz` and bump the major versions on semver violations.
1. Merging to `main` will create a new release PR containing any unreleased changes.
2. Optional. Change the proposed crate version, CHANGELOG edits.
3. The release PR gets merged to `main` when we are ready to publish the release.
4. The crates are published to crates.io, a new git tag is created, as well as a GitHub release
5. A job is run to pre-build the executable for our supported targets and upload them to the created Github release.
6. Merge the `main` branch back to the `next` branch.

### Release of the Miden Compiler and Miden SDK crates
### Release of the Miden SDK crates

The release process for the Miden Compiler and Miden SDK is managed using the `release-plz` tool. The following steps outline the process for creating a new release:

1. Run `release-plz update` in the repo root folder to update the crates versions and generate changelogs.
2. Create a release PR naming the branch with the `release-plz-` prefix (its important to use this prefix to trigger the crate publishing on CI in step 4).
3. Review the changes in the release PR, commit edits if needed and merge it into the main branch.
1. Create a release PR naming the branch with the `release-plz-` prefix (its important to use this prefix to trigger the crate publishing on CI in one of the next steps).
2. Bump the SDK crates versions and update the CHANGELOG.
3. Merge it into the main branch.
4. The CI will automatically run `release-plz release` after the release PR is merged to publish the new versions to crates.io.
5. Set a git tag for the published crates to mark the release.
6. Make a Github release.
7. Merge the `main` branch back to the `next` branch.
16 changes: 16 additions & 0 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,22 @@ args = [
"midenc",
"--artifact-dir",
"${MIDENC_BIN_DIR}",
"@@split(CARGO_MAKE_TASK_ARGS, )",
]

[tasks.cargo-miden]
category = "Build"
description = "Builds cargo-miden and installs it to the bin folder"
command = "cargo"
args = [
"-Z",
"unstable-options",
"build",
"-p",
"cargo-miden",
"--artifact-dir",
"${MIDENC_BIN_DIR}",
"@@split(CARGO_MAKE_TASK_ARGS, )",
]

[tasks.build]
Expand Down
28 changes: 20 additions & 8 deletions release-plz.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
[workspace]
# Only publish when the release PR is merged (starts with `release-plz-`)
# https://release-plz.ieni.dev/docs/config#the-release_always-field
pr_branch_prefix = "release-plz-"
# Only publish when the release PR is merged
# https://release-plz.dev/docs/config#the-release_always-field
release_always = false
# Do not create a github release
# https://release-plz.ieni.dev/docs/config#the-git_release_enable-field
git_release_enable = false
# Does not create a git tag
# https://release-plz.ieni.dev/docs/config#the-git_tag_enable-field
git_tag_enable = false
# Skip GitHub releases and git tags by default, individual crates can opt in
git_release_enable = false
git_tag_enable = false

[[package]]
name = "midenc"
git_release_enable = true
git_tag_enable = true
git_tag_name = "{{ version }}"
git_release_name = "{{ version }}"

# SDK
[[package]]
name = "miden"
git_release_enable = false
git_tag_enable = true
git_tag_name = "SDK-v{{ version }}"