-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AZ-219 Replaced statefull force push check when pull requests are mer…
…ged (#168) * AZ-219 Replaced statefull force push check when pull requests are merged to main with stateless check when a commit on PR to main is pushed.
- Loading branch information
1 parent
5491677
commit ae1d05a
Showing
9 changed files
with
119 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
function get_major_version() { | ||
echo "$1" | cut -d '.' -f 1 | ||
} | ||
|
||
function get_minor_version() { | ||
echo "$1" | cut -d '.' -f 2 | ||
} | ||
|
||
function trim_version() { | ||
grep -e "$1" "$2" | cut -d "=" -f 2 | tr -d "\"^ " | ||
} | ||
|
||
function check_versions() { | ||
if [ "$1" != "$2" ]; then | ||
echo "aleph-bft Cargo's toml $3 version $1 different than README.md's $3 version $2!" | ||
exit 1 | ||
fi | ||
} | ||
|
||
cargo_toml_version=$(trim_version '^version =' "Cargo.toml") | ||
cargo_toml_major_version=$(get_major_version "${cargo_toml_version}") | ||
cargo_toml_minor_version=$(get_minor_version "${cargo_toml_version}") | ||
|
||
readme_version=$(trim_version '\s*aleph-bft =' "README.md") | ||
readme_major_version=$(get_major_version "${readme_version}") | ||
readme_minor_version=$(get_minor_version "${readme_version}") | ||
|
||
check_versions "${cargo_toml_major_version}" "${readme_major_version}" "major" | ||
check_versions "${cargo_toml_minor_version}" "${readme_minor_version}" "minor" | ||
echo "Versions from README and Cargo.toml match." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Version bump check for code changes | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- 'src/**' | ||
|
||
jobs: | ||
check-versions: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: check-cargo-toml-version-bumped | ||
run: | | ||
if ! git diff HEAD origin/main -- Cargo.toml | grep -q '^+version ='; then | ||
echo "None of commits in this PR has changed version in Cargo.toml!" | ||
exit 1 | ||
fi | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Publish to crates.io | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'Cargo.toml' | ||
|
||
jobs: | ||
publish: | ||
# need to rename environment name after this is merged | ||
environment: Autobump version | ||
runs-on: ubuntu-latest | ||
if: ${{ github.repository == 'Cardinal-Cryptography/AlephBFT'}} | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
- name: credentials | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: login | ||
args: ${{ secrets.CRATES_IO_TOKEN }} | ||
- name: publish | ||
run: | | ||
if git diff HEAD~ -- Cargo.toml | grep -q '^+version ='; then | ||
echo "Version in Cargo.toml was bumped in this PR, publishing to crates.io." | ||
cargo publish | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Versions are aligned | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- 'Cargo.toml' | ||
- 'README.md' | ||
|
||
jobs: | ||
check-versions: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
- name: cargo-toml-match-readme-version | ||
run: ./.github/scripts/cargo-toml-match-readme-version.sh | ||
shell: bash |
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters