-
Notifications
You must be signed in to change notification settings - Fork 39
71 lines (62 loc) · 2.42 KB
/
release-please-prepare-branch.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
on:
push:
branches:
- release-please--branches--main--components--era-consensus
env:
EXPECTED_COMMIT_MESSAGE: "Update version in Cargo.toml"
CARGO_TERM_COLOR: "always"
CARGO_INCREMENTAL: "0"
# Rust version to use.
# Should be aligned with the version used in core to prevent regressions on publish.
nightly: nightly-2024-08-01
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.toml is already updated"
echo "already_committed=true" >> "$GITHUB_OUTPUT"
else
echo "Cargo.toml 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 '.node')
cargo-set-version set-version $NEW_VERSION --workspace --manifest-path node/Cargo.toml
- name: Push changes
run: |
git config --global user.email "[email protected]"
git config --global user.name "zksync-era-bot"
git remote set-url origin 'https://${{ secrets.RELEASE_TOKEN }}@github.com/matter-labs/era-consensus.git'
git add ./node/Cargo.toml
git commit -m "$EXPECTED_COMMIT_MESSAGE"
git push