File tree Expand file tree Collapse file tree 6 files changed +108
-62
lines changed
Expand file tree Collapse file tree 6 files changed +108
-62
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -e
4+
5+ function get_major_version() {
6+ echo " $1 " | cut -d ' .' -f 1
7+ }
8+
9+ function get_minor_version() {
10+ echo " $1 " | cut -d ' .' -f 2
11+ }
12+
13+ function trim_version() {
14+ grep -e " $1 " " $2 " | cut -d " =" -f 2 | tr -d " \" ^ "
15+ }
16+
17+ function check_versions() {
18+ if [ " $1 " != " $2 " ]; then
19+ echo " aleph-bft Cargo's toml $3 version $1 different than README.md's $3 version $2 !"
20+ exit 1
21+ fi
22+ }
23+
24+ cargo_toml_version=$( trim_version ' ^version =' " Cargo.toml" )
25+ cargo_toml_major_version=$( get_major_version " ${cargo_toml_version} " )
26+ cargo_toml_minor_version=$( get_minor_version " ${cargo_toml_version} " )
27+
28+ readme_version=$( trim_version ' \s*aleph-bft =' " README.md" )
29+ readme_major_version=$( get_major_version " ${readme_version} " )
30+ readme_minor_version=$( get_minor_version " ${readme_version} " )
31+
32+ check_versions " ${cargo_toml_major_version} " " ${readme_major_version} " " major"
33+ check_versions " ${cargo_toml_minor_version} " " ${readme_minor_version} " " minor"
34+ echo " Versions from README and Cargo.toml match."
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -e
4+
5+ if [ -z " $( git diff HEAD origin/main -- src/) " ]; then
6+ echo " No changes in the code."
7+ exit 0
8+ fi
9+
10+ if [ -z " $( git diff HEAD origin/main -- Cargo.toml | grep ' ^+version =' ) " ]; then
11+ echo " None of commits in this PR has changed version in Cargo.toml!"
12+ exit 1
13+ fi
Original file line number Diff line number Diff line change 1+ name : Check if PR has bumbed versions in Cargo.toml for code changes and if README is synchronized
2+
3+ on :
4+ pull_request :
5+ branches :
6+ - main
7+
8+ jobs :
9+ check-versions :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - name : checkout
13+ uses : actions/checkout@v2
14+ with :
15+ fetch-depth : 0
16+ - name : check-cargo-toml-version-bumped
17+ run : ./.github/scripts/check-cargo-toml-version-bumped.sh
18+ shell : bash
19+ - name : cargo-toml-match-readme-version
20+ run : ./.github/scripts/cargo-toml-match-readme-version.sh
21+ shell : bash
Original file line number Diff line number Diff line change 1+ name : Publish to crates.io
2+
3+ on :
4+ push :
5+ branches :
6+ main
7+
8+ jobs :
9+ publish :
10+ # need to rename environment name after this is merged
11+ environment : Autobump version
12+ runs-on : ubuntu-latest
13+ if : ${{ github.repository == 'Cardinal-Cryptography/AlephBFT'}}
14+ steps :
15+ - name : checkout
16+ uses : actions/checkout@v2
17+ with :
18+ fetch-depth : 2
19+ - name : force publish if version bumped
20+ run : |
21+ if [ -n "$(git diff HEAD~ -- Cargo.toml | grep '^+version =')" ]; then
22+ echo "Version in Cargo.toml was bumped in this PR, publishing to crates.io."
23+ touch publishMe
24+ fi
25+ - uses : actions-rs/toolchain@v1
26+ with :
27+ toolchain : stable
28+ - name : credentials
29+ uses : actions-rs/cargo@v1
30+ with :
31+ command : login
32+ args : ${{ secrets.CRATES_IO_TOKEN }}
33+ - name : publish
34+ run : |
35+ if [ -f publishMe ]; then
36+ echo "cargo publish"
37+ fi
Original file line number Diff line number Diff line change 11name : Sync Cardinal-Cryptography repo with Aleph-Zero-Foundation repo
22
33on :
4- workflow_run :
5- workflows : ["Autobump version"]
6- branches : [main]
7- types :
8- - completed
4+ push :
5+ branches :
6+ main
97
108jobs :
119 sync :
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments