Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e1ff059
debug
Dec 13, 2021
5491677
Revert "debug" (#164)
pmikolajczyk41 Dec 13, 2021
4bf02ae
Refactoring version bumping
KazyCC Dec 8, 2021
402b6b3
Splitting version-bump job triggered on "push" to "main" into two job…
KazyCC Dec 9, 2021
7e03172
AZ-219 splitting autobum into two files, in order to not using force …
KazyCC Dec 9, 2021
753cef5
Temporary adding test_main branch handling for testing
KazyCC Dec 9, 2021
0d4ff1b
Removing cargo publish from test_main branch testing
KazyCC Dec 9, 2021
1f9b007
Changing creates publish into manual workflow_dispatch
KazyCC Dec 15, 2021
5ae61db
Simplfing the push command
KazyCC Dec 15, 2021
f6eb26d
Prcising the checkout
KazyCC Dec 15, 2021
de09bcf
Working on tokens for the checkout
KazyCC Dec 15, 2021
91e51be
Working on tokens for the checkout (2)
KazyCC Dec 15, 2021
9b29dad
Cleanup of both version prep and autobump
KazyCC Dec 15, 2021
85fde32
Cleanup of both version prep and autobump (2)
KazyCC Dec 15, 2021
36e6263
Switch to apply version of PR branch, not target branch.
KazyCC Dec 15, 2021
4ae86fa
Adding tags pushing
KazyCC Dec 15, 2021
a436772
Adding tags pushing
KazyCC Dec 15, 2021
624aad4
Adding check to do not try to create duplicate tags.
KazyCC Dec 15, 2021
c158f4a
Setting version to 0.8.3
Dec 15, 2021
56c0308
Cleanup before PR
KazyCC Dec 15, 2021
708aa43
Renaming
KazyCC Dec 15, 2021
b8df6b4
Cargo.lock version update
KazyCC Dec 15, 2021
dc09229
Improving name to clearly state purpose.
KazyCC Dec 15, 2021
4339e93
Resolving PR comments
KazyCC Dec 16, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/prepare-version-bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Autobump version on PR

on:
pull_request:
branches:
- main

jobs:
prepare-new-version:
environment: Autobump version
runs-on: ubuntu-latest
if: ${{ github.repository == 'Cardinal-Cryptography/AlephBFT'}}
steps:
- name: cargo-next-install
run: |
cargo install cargo-next --locked
- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 2
ref: ${{ github.head_ref }}
token: ${{ secrets.SYNCAZF || secrets.MY_TOKEN || github.token }}
- name: check-and-bump
run: |
old_version=`cargo next --get`
# If version on PR branch and main branch have no differences in version -> bump it.
# Set version in README.md, commit, tag and push to PR branch.
# Assuming nominal version for us is the one in the top level Cargo.toml.
if ! git diff ${{ github.head_ref }} ${{ github.base_ref }} -- Cargo.toml | grep -q '^+version ='; then
echo "Version $old_version has NOT been changed manually between ${{ github.head_ref }} and ${{ github.base_ref }}, patching it now."
cargo next --patch
new_version=`cargo next --get`
echo "New version is $new_version."
git add Cargo.toml
fi
new_version=`cargo next --get`
# Make sure README has the same version as Cargo.toml.
sed -i "s/^version = \"$version\"$/version = \"$new_version\"/" Cargo.toml
git add README.md
# Publishing changes to PR branch
git config user.email "<>"
git config user.name "Version autobump"
git commit -m "Setting version to $new_version"
# Create tag with version if it not exist.
if ! git rev-parse "$new_version" >/dev/null 2>&1; then
git tag -a $new_version -m "Version $new_version created at PR ${{ github.head_ref }} -> ${{ github.base_ref }}"
fi
- name: push-to-PR
run: |
git push --follow-tags
2 changes: 1 addition & 1 deletion .github/workflows/push-foundation-repo.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Sync Cardinal-Cryptography repo with Aleph-Zero-Foundation repo
name: Sync Cardinal-Cryptography repo with Aleph-Zero-Foundation repo.

on:
workflow_run:
Expand Down
49 changes: 12 additions & 37 deletions .github/workflows/version-bump.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,22 @@
name: Autobump version

on:
push:
branches:
- main
workflow_dispatch:
# NOTE: changed to "manual workflow dispatch" for now.
# TODO: To be automated again, when workflows stabilize
# and pushes to main origin will be forbidden.
# push:
# branches:
# - main



jobs:
autobump:
environment: Autobump version
runs-on: ubuntu-latest
if: ${{ github.repository == 'Cardinal-Cryptography/AlephBFT'}}
steps:
- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: bump
run: |
version=`grep -e '^version =' Cargo.toml | sed 's/version = //' | sed 's/"//g'`
major_version=`echo $version|grep -o -e '^[0-9]*'`
minor_version=`echo $version|grep -o -e '^[0-9]*.[0-9]*'|grep -o -e '[0-9]*$'`
patch_version=`echo $version|grep -o -e '[0-9]*$'`
git config user.email "<>"
git config user.name "Version autobump"
if git diff HEAD~ -- Cargo.toml | grep -q '^+version ='; then
echo 'Version has been bumped manually, bumping readme version and uploading to crates.io'
new_version=$major_version.$minor_version
sed -i "s/aleph-bft = \"\^[0-9]*.[0-9]*\"$/aleph-bft = \"^$new_version\"/" README.md
git add README.md
git commit --amend --no-edit
git push -f origin main
touch publishMe
exit 0
fi
if [ -e `git diff HEAD~ -- src/` ]; then
echo 'No changes in code.'
exit 0
fi
new_version=$major_version.$minor_version.$((patch_version + 1))
sed -i "s/^version = \"$version\"$/version = \"$new_version\"/" Cargo.toml
git add Cargo.toml
git commit --amend --no-edit
git push -f origin main
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
Expand All @@ -52,6 +27,6 @@ jobs:
args: ${{ secrets.CRATES_IO_TOKEN }}
- name: publish
run: |
if [ -f publishMe ]; then
cargo publish
fi
echo 'Uploading to crates.io'
cargo publish

2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aleph-bft"
version = "0.8.0"
version = "0.8.3"
edition = "2018"
authors = ["Cardinal Cryptography"]
categories = ["algorithms", "data-structures", "cryptography", "database"]
Expand Down