From f883bded85ed425a845766432d776d8ccda9821e Mon Sep 17 00:00:00 2001 From: plebhash Date: Mon, 19 Aug 2024 13:04:30 -0300 Subject: [PATCH 1/2] rm scripts/check-versioning-lib-release.sh --- .github/workflows/release-libs.yaml | 8 ---- scripts/check-versioning-lib-release.sh | 60 ------------------------- 2 files changed, 68 deletions(-) delete mode 100755 scripts/check-versioning-lib-release.sh diff --git a/.github/workflows/release-libs.yaml b/.github/workflows/release-libs.yaml index ac7883dba..a6fcc776b 100644 --- a/.github/workflows/release-libs.yaml +++ b/.github/workflows/release-libs.yaml @@ -22,14 +22,6 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Run check-versioning-lib-release.sh - run: | - ./check-versioning-lib-release.sh - if [ $? -eq 1 ]; then - echo "Script returned exit code 1, halting the workflow" - exit 1 - fi - - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: diff --git a/scripts/check-versioning-lib-release.sh b/scripts/check-versioning-lib-release.sh deleted file mode 100755 index 5fdf6eb91..000000000 --- a/scripts/check-versioning-lib-release.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash - -git fetch --all - -crates=( -"utils/buffer" -"protocols/v2/binary-sv2/no-serde-sv2/derive_codec" -"protocols/v2/binary-sv2/no-serde-sv2/codec" -"protocols/v2/binary-sv2/serde-sv2" -"protocols/v2/binary-sv2/binary-sv2" -"protocols/v2/const-sv2" -"protocols/v2/framing-sv2" -"protocols/v2/noise-sv2" -"protocols/v2/codec-sv2" -"protocols/v2/subprotocols/common-messages" -"protocols/v2/subprotocols/job-declaration" -"protocols/v2/subprotocols/mining" -"protocols/v2/subprotocols/template-distribution" -"protocols/v2/sv2-ffi" -"protocols/v2/roles-logic-sv2" -"protocols/v1" -"utils/bip32-key-derivation" -"utils/error-handling" -"utils/key-utils" -"roles/roles-utils/network-helpers" -"roles/roles-utils/rpc" -"roles/jd-client" -"roles/jd-server" -"roles/mining-proxy" -"roles/pool" -"roles/translator" -) - -# Loop through each crate -for crate in "${crates[@]}"; do - cd "$crate" - - # Check if the branches exist locally, if not, create them - git show-ref --verify --quiet refs/remotes/origin/main || { echo "Branch 'main' not found."; exit 1; } - git show-ref --verify --quiet refs/remotes/origin/dev || { echo "Branch 'dev' not found."; exit 1; } - - # Check if there were any changes between dev and main - git diff --quiet "origin/dev" "origin/main" -- . - if [ $? -ne 0 ]; then - - # Check if crate versions on dev and main are identical - version_dev=$(git show origin/dev:./Cargo.toml | awk -F' = ' '$1 == "version" {gsub(/[ "]+/, "", $2); print $2}') - version_main=$(git show origin/main:./Cargo.toml | awk -F' = ' '$1 == "version" {gsub(/[ "]+/, "", $2); print $2}') - if [ "$version_dev" = "$version_main" ]; then - # this prevents the release PR from being merged, since we do `exit 1`, effectively stopping the Github CI - echo "Changes detected in crate $crate between dev and main branches! Versions on dev and main branches are identical ($version_dev), so you should bump the crate version on dev before merging into main." - exit 1 - else - # this creates a log of version changes, useful for release logs - echo "Changes detected in crate $crate between dev and main branches! Version in dev is: ($version_dev), while version in main is ($version_main)." - fi - fi - - cd - >/dev/null -done \ No newline at end of file From b3dde39b327de55003efbec3f1e32655d16504e0 Mon Sep 17 00:00:00 2001 From: plebhash Date: Mon, 19 Aug 2024 13:16:11 -0300 Subject: [PATCH 2/2] only release libs on merges to main --- .github/workflows/release-libs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-libs.yaml b/.github/workflows/release-libs.yaml index a6fcc776b..24e925196 100644 --- a/.github/workflows/release-libs.yaml +++ b/.github/workflows/release-libs.yaml @@ -11,7 +11,7 @@ name: Release Libs on: - pull_request: + push: branches: - main