-
Notifications
You must be signed in to change notification settings - Fork 6
70 lines (61 loc) · 2.3 KB
/
release-please-prepare-branch.yaml
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
on:
push:
branches:
- release-please--branches--main--components--zksync-crypto
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
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-crypto.git'
git add ./Cargo.toml
git commit -m "$EXPECTED_COMMIT_MESSAGE"
git push