-
Notifications
You must be signed in to change notification settings - Fork 2
72 lines (62 loc) · 2.37 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
72
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-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.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
- 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: ""
- name: Install cargo-workspaces
run: cargo install cargo-workspaces
- name: Extract version from PR title
id: extract_version
run: |
NEW_VERSION=$(echo "${{ github.event.pull_request.title }}" | grep -oP 'v\d+\.\d+\.\d+')
echo "version=$NEW_VERSION" >> "$GITHUB_ENV"
- name: Bump version
run: |
cargo ws version custom $NEW_VERSION --yes --no-git-commit --exact
- 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/zksync-era.git'
git add ./Cargo.toml
git commit -m "$EXPECTED_COMMIT_MESSAGE"
git push