mirror of
https://github.com/fluencelabs/aquavm
synced 2024-12-04 15:20:16 +00:00
CI: fix release versions calculation (#58)
This commit is contained in:
parent
dabadeb75b
commit
459615e828
20
.github/workflows/publish_interpreter.yml
vendored
20
.github/workflows/publish_interpreter.yml
vendored
@ -28,7 +28,7 @@ jobs:
|
||||
~/.cargo/git
|
||||
~/.cargo/bin
|
||||
target
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||
key: ${{ runner.os }}-cargo-v1-${{ hashFiles('**/Cargo.lock') }}
|
||||
- name: Install Rust toolchain with wasm32-unknown-unknown
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
@ -61,24 +61,32 @@ jobs:
|
||||
yarn global add semver
|
||||
PATH="$(yarn global bin):$PATH"
|
||||
|
||||
# JQ version regex pattern
|
||||
PAT="\\\\d+.\\\\d+.\\\\d+"
|
||||
|
||||
STEPPER_CARGO_TOML="stepper/Cargo.toml"
|
||||
CARGO_TOML="crates/air-interpreter-wasm/Cargo.toml"
|
||||
# get package name from Cargo.toml
|
||||
RS_PKG_NAME="$(toml get "$CARGO_TOML" package.name | tr -d \")"
|
||||
JS_PKG_NAME="@fluencelabs/aquamarine-stepper"
|
||||
|
||||
# get version from Cargo.toml
|
||||
STEPPER_RUST_VERSION="$(toml get "$STEPPER_CARGO_TOML" package.version | tr -d \")"
|
||||
LOCAL_RUST_VERSION="$(toml get "$CARGO_TOML" package.version | tr -d \")"
|
||||
|
||||
# get & increment version from NPM
|
||||
JS_VERSION="$(yarn info --silent "$JS_PKG_NAME" version || true)"
|
||||
JS_VERSIONS=$(yarn info --silent "$JS_PKG_NAME" versions | tr \' \" | jq -r ".[] | select(test(\"$PAT\"))" || true)
|
||||
JS_VERSION="$(semver -p $JS_VERSIONS | tail -n1)"
|
||||
NEXT_JS_VERSION="$(semver --increment patch "$JS_VERSION" || true)"
|
||||
|
||||
# get & increment version from crates.io
|
||||
RS_VERSION="$((cargo show --json "$RS_PKG_NAME" | jq -r .crate.max_version) 2>/dev/null || true)"
|
||||
NEXT_RS_VERSION="$(semver --increment patch "$RS_VERSION" || true)"
|
||||
CRATE_VERSIONS=$(cargo show --json "$RS_PKG_NAME")
|
||||
CRATE_VERSIONS_FILTERED=$(echo $CRATE_VERSIONS | jq -r ".versions[] | .num | select(test(\"$PAT\"))")
|
||||
MAX_RS_VERSION="$(semver -p $CRATE_VERSIONS_FILTERED | tail -n1 || true)"
|
||||
NEXT_RS_VERSION="$(semver --increment patch "$MAX_RS_VERSION" || true)"
|
||||
|
||||
# take the highest version
|
||||
MAX_VERSION="$(semver "$NEXT_JS_VERSION" "$NEXT_RS_VERSION" "$LOCAL_RUST_VERSION" | tail -n1)"
|
||||
MAX_VERSION="$(semver "$NEXT_JS_VERSION" "$NEXT_RS_VERSION" "$LOCAL_RUST_VERSION" "$STEPPER_RUST_VERSION" | tail -n1)"
|
||||
|
||||
echo "FINAL_VERSION=$MAX_VERSION" | tee -a $GITHUB_ENV
|
||||
echo "JS_PKG_NAME=$JS_PKG_NAME" | tee -a $GITHUB_ENV
|
||||
@ -188,7 +196,7 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ env.FINAL_VERSION }}
|
||||
release_name: Fluence Network ${{ env.FINAL_VERSION }}
|
||||
release_name: AIR interpreter ${{ env.FINAL_VERSION }}
|
||||
body: |
|
||||
- [${{ env.FINAL_VERSION }} @ NPM registry](https://www.npmjs.com/package/${{ env.JS_PKG_NAME }}/v/${{ env.FINAL_VERSION }})
|
||||
- [${{ env.FINAL_VERSION }} @ crates.io](https://crates.io/crates/${{ env.PKG_NAME }}/${{ env.FINAL_VERSION }})
|
||||
|
@ -74,6 +74,8 @@ jobs:
|
||||
|
||||
# sanitize branch name so it can be used as a semver suffix (replace [^0-9a-zA-Z-] with hyphen)
|
||||
SANITIZED_BRANCH="$(echo -n "${{ env.BRANCH_NAME }}" | tr -C '[:alnum:]-' -)"
|
||||
# JQ Version regex pattern
|
||||
PAT="\\\\d+.\\\\d+.\\\\d+-$SANITIZED_BRANCH.\\\\d+"
|
||||
|
||||
# get package name from Cargo.toml
|
||||
PKG_NAME="$(toml get "$CARGO_TOML" package.name | tr -d \")"
|
||||
@ -83,7 +85,7 @@ jobs:
|
||||
# take all versions from npm and replace single quotes with double quotes
|
||||
NPM_VERSIONS=$(yarn info --silent "$JS_PKG_NAME" versions 2>/dev/null | tr \' \")
|
||||
# take only versions that contain branch name
|
||||
NPM_VERSIONS_FILTERED=$(echo $NPM_VERSIONS | jq -r ".[] | select(contains(\"$SANITIZED_BRANCH\"))")
|
||||
NPM_VERSIONS_FILTERED=$(echo $NPM_VERSIONS | jq -r ".[] | select(test(\"$PAT\"))")
|
||||
# flatten into a single line
|
||||
NPM_VERSIONS_FLATTENED=$(echo $NPM_VERSIONS_FILTERED | awk '{print}' ORS=' ')
|
||||
# sort versions according to semver, take highest (last)
|
||||
@ -93,7 +95,7 @@ jobs:
|
||||
|
||||
### CRATES.IO
|
||||
CRATE_VERSIONS=$(cargo show --json "$PKG_NAME")
|
||||
CRATE_VERSIONS_FILTERED=$(echo $CRATE_VERSIONS | jq -r ".versions[] | .num | select(contains(\"$SANITIZED_BRANCH\"))")
|
||||
CRATE_VERSIONS_FILTERED=$(echo $CRATE_VERSIONS | jq -r ".versions[] | .num | select(test(\"$PAT\"))")
|
||||
CRATE_VERSIONS_FLATTENED=$(echo $CRATE_VERSIONS_FILTERED | awk '{print}' ORS=' ')
|
||||
LAST_CRATE_VERSION="$(semver -p $(echo $CRATE_VERSIONS_FLATTENED) | tail -n1 || true)"
|
||||
PRERELEASE_CRATE_VERSION="$(semver --increment prerelease --preid "$SANITIZED_BRANCH" "${LAST_CRATE_VERSION}" || true)"
|
||||
|
28
Cargo.lock
generated
28
Cargo.lock
generated
@ -56,7 +56,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "aquamarine"
|
||||
version = "0.2.3"
|
||||
version = "0.3.0"
|
||||
dependencies = [
|
||||
"fluence",
|
||||
"log",
|
||||
@ -632,12 +632,13 @@ checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
|
||||
|
||||
[[package]]
|
||||
name = "fce"
|
||||
version = "0.1.29"
|
||||
version = "0.1.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "024ac74e329d2446f8a6cde60ca26f6a159cf0d660568a156e3de499bf3011e8"
|
||||
checksum = "9deb5e4f0e1533694ffbfd3644b8047ae41e8098165cdf5934a60b71f82e30c9"
|
||||
dependencies = [
|
||||
"boolinator",
|
||||
"fce-utils",
|
||||
"fce-wit-generator",
|
||||
"fce-wit-interfaces",
|
||||
"fce-wit-parser",
|
||||
"log",
|
||||
@ -659,6 +660,21 @@ version = "0.1.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b7a516882dccba04f0034e288c1aa5f06ce9da2711a7ce984ceebac8117e185e"
|
||||
|
||||
[[package]]
|
||||
name = "fce-wit-generator"
|
||||
version = "0.1.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4e19c183d232092a59aeaa4f22212699b3da2acf0bcc5329a9de2a7bb7aa9f87"
|
||||
dependencies = [
|
||||
"fce-wit-parser",
|
||||
"fluence-sdk-wit",
|
||||
"once_cell",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"walrus",
|
||||
"wasmer-interface-types-fl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fce-wit-interfaces"
|
||||
version = "0.1.29"
|
||||
@ -717,9 +733,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "fluence-faas"
|
||||
version = "0.1.29"
|
||||
version = "0.1.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f0ec0c180f1c40573283320e422790e62120873c22d8b7b3aa50ea95f011bb8"
|
||||
checksum = "a74511b8a8fc16e3cb3749631824b90f89cecb742cbbaf4e467a0873e34a5a53"
|
||||
dependencies = [
|
||||
"cmd_lib",
|
||||
"fce",
|
||||
@ -1651,7 +1667,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "stepper-lib"
|
||||
version = "0.2.3"
|
||||
version = "0.3.0"
|
||||
dependencies = [
|
||||
"air-parser",
|
||||
"aqua-test-utils",
|
||||
|
4
crates/air-interpreter-wasm/Cargo.lock
generated
4
crates/air-interpreter-wasm/Cargo.lock
generated
@ -97,7 +97,7 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.118"
|
||||
version = "1.0.119"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9bdd36f49e35b61d49efd8aa7fc068fd295961fd2286d0b2ee9a4c7a14e99cc3"
|
||||
dependencies = [
|
||||
@ -106,7 +106,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.118"
|
||||
version = "1.0.119"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "552954ce79a059ddd5fd68c271592374bd15cab2274970380c000118aeffe1cd"
|
||||
dependencies = [
|
||||
|
Loading…
Reference in New Issue
Block a user