diff --git a/.github/release-please/config.json b/.github/release-please/config.json deleted file mode 100644 index 06ef81a..0000000 --- a/.github/release-please/config.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "bootstrap-sha": "4bb5cca0b113f06185201d10db31a73f0f56ea1e", - "include-component-in-tag": false, - "bump-minor-pre-major": true, - "bump-patch-for-minor-pre-major": true, - "packages": { - ".": { - "component": "zksync-protocol", - "release-type": "simple" - } - } -} diff --git a/.github/release-please/manifest.json b/.github/release-please/manifest.json deleted file mode 100644 index 956bf95..0000000 --- a/.github/release-please/manifest.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - ".": "0.150.17" -} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1569e2c..1cd996d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,10 +1,6 @@ name: "Rust CI" on: pull_request: - paths: - - "crates/**" - - "Cargo.toml" - - ".github/workflows/ci.yaml" concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} diff --git a/.github/workflows/release-please-prepare-branch.yml b/.github/workflows/release-please-prepare-branch.yml deleted file mode 100644 index f1e402a..0000000 --- a/.github/workflows/release-please-prepare-branch.yml +++ /dev/null @@ -1,70 +0,0 @@ -on: - push: - branches: - - release-please--branches--main--components--zksync-protocol - -env: - EXPECTED_COMMIT_MESSAGE: "Update version in Cargo.toml" - CARGO_TERM_COLOR: "always" - CARGO_INCREMENTAL: "0" - # Rust version to use. - nightly: nightly-2024-11-19 - -name: release-please-update-versions -jobs: - check_state: - name: "release-please: Check if Cargo.toml is updated" - runs-on: [ubuntu-latest] - outputs: - already_committed: ${{ steps.condition.outputs.already_committed }} - - steps: - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 - - - name: Check last commit - id: condition - run: | - COMMIT=$(git log -1 --pretty=%B) - if [[ "$COMMIT" == "$EXPECTED_COMMIT_MESSAGE" ]]; then - echo "Cargo.lock is already updated" - echo "already_committed=true" >> "$GITHUB_OUTPUT" - else - echo "Cargo.lock should be updated" - echo "already_committed=false" >> "$GITHUB_OUTPUT" - fi - - update_version: - runs-on: [ubuntu-latest] - name: "release-please: Update version in Cargo.toml" - needs: [check_state] - if: ${{ needs.check_state.outputs.already_committed != 'true' }} - steps: - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 - with: - persist-credentials: false - - - name: Install Rust - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - toolchain: ${{ env.nightly }} - components: rustfmt, clippy - # Remove default `-D warnings`. This is a temporary measure. - rustflags: "" - - # cargo-workspaces fails to update versions in some cases. - - name: Install cargo-edit - run: cargo install cargo-edit - - - name: Bump version - run: | - NEW_VERSION=$(cat .github/release-please/manifest.json | jq -r '."."') - cargo-set-version set-version $NEW_VERSION --workspace - - - name: Push changes - run: | - git config --global user.email "zksync-era-bot@users.noreply.github.com" - git config --global user.name "zksync-era-bot" - git remote set-url origin 'https://${{ secrets.RELEASE_TOKEN }}@github.com/matter-labs/zksync-protocol.git' - git add ./Cargo.toml - git commit -m "$EXPECTED_COMMIT_MESSAGE" - git push diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml deleted file mode 100644 index 14a77fa..0000000 --- a/.github/workflows/release-please.yml +++ /dev/null @@ -1,90 +0,0 @@ -on: - push: - branches: - - main - workflow_dispatch: - -env: - CARGO_TERM_COLOR: "always" - CARGO_INCREMENTAL: "0" - RUSTC_WRAPPER: "sccache" - SCCACHE_GHA_ENABLED: "true" - # Rust version to use. - nightly: nightly-2024-11-19 - -permissions: - contents: write - pull-requests: write - -name: release-please -jobs: - release-please: - runs-on: ubuntu-latest - outputs: - releases_created: ${{ steps.release.outputs.releases_created }} - release_please_output_json: ${{ toJSON(steps.release.outputs) }} - steps: - - name: Run release-please - id: release - uses: googleapis/release-please-action@7987652d64b4581673a76e33ad5e98e3dd56832f # v4.1.3 - with: - token: ${{ secrets.RELEASE_TOKEN }} - config-file: .github/release-please/config.json - manifest-file: .github/release-please/manifest.json - - - name: Show outputs - env: - OUTPUTS: ${{ toJSON(steps.release.outputs) }} - run: echo "$OUTPUTS" - - process-release: - runs-on: [ubuntu-22.04-github-hosted-32core] - needs: [release-please] - if: ${{ needs.release-please.outputs.releases_created == 'true' }} - steps: - - name: Checkout code - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 - - - name: Install Rust - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - toolchain: ${{ env.nightly }} - # Remove default `-D warnings`. This is a temporary measure. - rustflags: "" - - - name: Install sccache - uses: mozilla-actions/sccache-action@v0.0.4 - - - name: Install cargo-workspaces - run: cargo install cargo-workspaces - - - name: Build each package separately - run: cargo ws exec cargo build - - - name: Login to crates.io - run: cargo login ${{ secrets.CRATES_IO_TOKEN }} - - - name: Publish - run: cargo ws publish --publish-as-is --allow-dirty - - - name: Set owners for new packages - # `cargo owner --add` fails if the package is already owned by the same entity, - # so we have to check if the package is already owned by the organization. - run: | - ORG_OWNER=github:matter-labs:crates-io - for PKG in $(cargo ws list); do - cargo owner --list --quiet $PKG | grep $ORG_OWNER || cargo owner --add $ORG_OWNER $PKG - done - - - name: Send Release Info - uses: matter-labs/format-release-please-for-slack-action@69e6fe9e4ec531b7b5fb0d826f73c190db83cf42 # v2.1.0 - with: - release-please-output: ${{ needs.release-please.outputs.release_please_output_json }} - slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_RELEASES }} - - - name: Notify about failure - if: failure() - uses: matter-labs/format-release-please-for-slack-action@69e6fe9e4ec531b7b5fb0d826f73c190db83cf42 # v2.1.0 - with: - release-please-output: '{ "body": "⚠️ Failed to publish the release" }' - slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_RELEASES }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..a9c9934 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,30 @@ +name: Release + +on: + push: + branches: + - main + +jobs: + + rust-toolchain: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.rust-toolchain.outputs.version }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Extract rust toolchain version + id: rust-toolchain + run: echo "version=$(cat rust-toolchain)" >> "${GITHUB_OUTPUT}" + + release: + needs: rust-toolchain + uses: matter-labs/zksync-ci-common/.github/workflows/release-plz.yaml@v1 + secrets: + gh_token: ${{ secrets.RELEASE_TOKEN }} + cargo_registry_token: ${{ secrets.CRATES_IO_TOKEN }} + slack_webhook: ${{ secrets.SLACK_WEBHOOK_RELEASES }} + with: + rust-toolchain: ${{ needs.rust-toolchain.outputs.version }} diff --git a/RELEASE.md b/RELEASE.md index ac5c2e8..cdf41ef 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -7,8 +7,7 @@ ## Automatic releases -We use [release-please](https://github.com/googleapis/release-please) to manage releases, as well -as a custom automation to publish releases on [crates.io](https://crates.io/). +We use [release-plz](https://release-plz.dev/) to manage and publish releases to [crates.io](https://crates.io/). Any pull request name must follow [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) specification, and then, based on the PR titles, a release pull request will be created, which @@ -22,7 +21,7 @@ sure that the change will trigger a release PR, mark the PR as `fix` or `feat`. By default, a patch version will be bumped. If you want to bump a minor version, mark the PR as breaking with an exclamation point, e.g. `feat!` or `fix!`. -It is recommended that each PR has a component mentioned, e.g. `feat(component): Change added`. +It is recommended that each PR has a component mentioned, e.g. `feat(component): change added`. Once release PR is merged, it will be published to `crates.io`, and a notification will be sent to Slack. @@ -31,8 +30,6 @@ Once release PR is merged, it will be published to `crates.io`, and a notificati > [!WARNING] > Manual releases are discouraged, and should only be used as a last resort measure. > Discuss the manual release with the team beforehand and prepare a plan. -> It is very likely that manual release will interfere with `release-please` configuration, -> which will have to be fixed manually as well. > > Additionally, if the release was created, but wasn't published, you will only need a subset > of the actions listed below (e.g. if the it failed due to a transient error, you just need to diff --git a/release-plz.toml b/release-plz.toml new file mode 100644 index 0000000..e62d750 --- /dev/null +++ b/release-plz.toml @@ -0,0 +1,24 @@ +[workspace] +dependencies_update = true # Wether to run `cargo update` in the release PR +pr_name = "chore(main): release {{version}}" # template for the PR name +pr_labels = ["release", "crates.io"] # Set PR labels +changelog_path = "./CHANGELOG.md" # Set common changelog path for all crates +changelog_update = false # Disable individual changelog updates for all packages. +git_tag_enable = false # Disable individual tags for all packages. +git_release_enable = false # Disable individual releases for all packages. +semver_check = false # Disable API breaking changes checks with cargo-semver-checks. +publish_timeout = "10m" # Set a timeout for `cargo publish`. + +# Use one package to combine changelog updates and tags for all workspace +[[package]] +name = "circuit_definitions" +git_release_enable = true # Enable GitHub releases +git_tag_enable = true # Enable one common tag for all crates +git_tag_name = "v{{version}}" # Common tag name for the workspace +git_release_name = "v{{version}}" # Common GitHub release name +changelog_update = true # Enable changelog updates combining all crates +changelog_include = [ + "circuit_encodings", "circuit_sequencer_api", "zksync_kzg", + "zkevm-assembly", "zk_evm", "zk_evm_abstractions", + "zkevm_circuits", "zkevm_opcode_defs", "zkevm_test_harness" +]