chore: RM - refreshed (#15)
* chore: Proper version distribution * chore: version based on tags --------- Co-authored-by: czareko <czareko@users.noreply.github.com>
This commit is contained in:
116
.github/workflows/release-proposal.yml
vendored
116
.github/workflows/release-proposal.yml
vendored
@@ -53,58 +53,73 @@ jobs:
|
||||
echo "commit_sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||
echo "source_branch=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Get current version from Cargo.toml
|
||||
id: current_version
|
||||
- name: Get latest tag
|
||||
id: latest_tag
|
||||
run: |
|
||||
current=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')
|
||||
echo "current=$current" >> $GITHUB_OUTPUT
|
||||
echo "Current version: $current"
|
||||
# Get all version tags and sort them by version
|
||||
latest_semver_tag=$(git tag -l "v[0-9]*.[0-9]*.[0-9]*" | sort -V | tail -n 1)
|
||||
|
||||
# If no tags found, use default
|
||||
if [ -z "$latest_semver_tag" ]; then
|
||||
latest_semver_tag="v0.0.0"
|
||||
fi
|
||||
|
||||
echo "latest_tag_found=$latest_semver_tag" >> $GITHUB_OUTPUT
|
||||
echo "Latest semantic version tag found: $latest_semver_tag"
|
||||
|
||||
- name: Calculate new version
|
||||
id: versioner
|
||||
env:
|
||||
CURRENT_VERSION: ${{ steps.current_version.outputs.current }}
|
||||
LATEST_TAG: ${{ steps.latest_tag.outputs.latest_tag_found }}
|
||||
VERSION_TYPE: ${{ github.event.inputs.version_type }}
|
||||
CUSTOM_VERSION: ${{ github.event.inputs.custom_version }}
|
||||
run: |
|
||||
# Remove 'v' prefix and any suffix for processing
|
||||
current_version=${LATEST_TAG#v}
|
||||
# Remove any suffix after the version number
|
||||
current_version=$(echo "$current_version" | sed -E 's/-[^-]+$//')
|
||||
|
||||
if [[ "$VERSION_TYPE" == "custom" ]]; then
|
||||
if [[ -z "$CUSTOM_VERSION" ]]; then
|
||||
echo "Error: Custom version is selected but no custom_version string provided."
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! "$CUSTOM_VERSION" =~ ^v ]]; then
|
||||
echo "Error: Custom version string MUST start with 'v' (e.g., v1.2.3)."
|
||||
exit 1
|
||||
fi
|
||||
new_version="$CUSTOM_VERSION"
|
||||
else
|
||||
# Parse current version
|
||||
IFS='.' read -ra VERSION_PARTS <<< "$CURRENT_VERSION"
|
||||
major=${VERSION_PARTS[0]}
|
||||
minor=${VERSION_PARTS[1]}
|
||||
patch=${VERSION_PARTS[2]}
|
||||
|
||||
# Calculate new version
|
||||
case $VERSION_TYPE in
|
||||
major)
|
||||
# Split version and pre-release part
|
||||
IFS='-' read -r version_core prerelease_part <<< "$current_version"
|
||||
IFS='.' read -r major minor patch <<< "$version_core"
|
||||
|
||||
# Increment based on type
|
||||
if [[ "$VERSION_TYPE" == "major" ]]; then
|
||||
if [[ "$major" == "0" ]]; then # Handle 0.x.y -> 0.(x+1).0
|
||||
major=$major
|
||||
minor=$((minor + 1))
|
||||
patch=0
|
||||
else
|
||||
major=$((major + 1))
|
||||
minor=0
|
||||
patch=0
|
||||
;;
|
||||
minor)
|
||||
minor=$((minor + 1))
|
||||
patch=0
|
||||
;;
|
||||
patch)
|
||||
patch=$((patch + 1))
|
||||
;;
|
||||
esac
|
||||
|
||||
new_version="$major.$minor.$patch"
|
||||
fi
|
||||
elif [[ "$VERSION_TYPE" == "minor" ]]; then
|
||||
minor=$((minor + 1))
|
||||
patch=0
|
||||
elif [[ "$VERSION_TYPE" == "patch" ]]; then
|
||||
patch=$((patch + 1))
|
||||
else
|
||||
echo "Error: Invalid version_type: $VERSION_TYPE"
|
||||
exit 1
|
||||
fi
|
||||
new_version="v$major.$minor.$patch"
|
||||
fi
|
||||
|
||||
new_tag="v$new_version"
|
||||
|
||||
echo "new_version=$new_version" >> $GITHUB_OUTPUT
|
||||
echo "new_tag=$new_tag" >> $GITHUB_OUTPUT
|
||||
|
||||
echo "New version: $new_version"
|
||||
echo "New tag: $new_tag"
|
||||
echo "new_version=$new_version" >> $GITHUB_OUTPUT
|
||||
echo "new_tag=$new_version" >> $GITHUB_OUTPUT
|
||||
|
||||
update-cargo-toml:
|
||||
name: 📝 Update version files
|
||||
@@ -122,9 +137,6 @@ jobs:
|
||||
- name: Setup rust
|
||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
|
||||
- name: Install cargo-edit
|
||||
run: cargo install cargo-edit --locked
|
||||
|
||||
- name: Create version bump branch and PR
|
||||
env:
|
||||
NEW_VERSION: ${{ needs.calculate-next-version.outputs.new_version }}
|
||||
@@ -134,27 +146,42 @@ jobs:
|
||||
TARGET_BRANCH: ${{ github.event.inputs.target_branch }}
|
||||
run: |
|
||||
set -ex
|
||||
branch_name="release/${NEW_TAG}"
|
||||
new_cargo_version=${NEW_VERSION#v}
|
||||
branch_name="release/${NEW_VERSION}"
|
||||
|
||||
# Create new branch from source branch
|
||||
git checkout "$SOURCE_BRANCH"
|
||||
git checkout -b "$branch_name"
|
||||
|
||||
# Update version in Cargo.toml
|
||||
echo "Updating Cargo.toml to version: $NEW_VERSION"
|
||||
cargo set-version "$NEW_VERSION"
|
||||
# Update version in workspace Cargo.toml (safer than cargo set-version)
|
||||
echo "Updating workspace Cargo.toml to version: $new_cargo_version"
|
||||
sed -i -E "s/^version\s*=\s*\"[0-9a-zA-Z.-]+\"/version = \"$new_cargo_version\"/" Cargo.toml
|
||||
|
||||
# Regenerate Cargo.lock with precise updates for our packages only
|
||||
cargo update -p miner-cli --precise "$new_cargo_version"
|
||||
cargo update -p miner-service --precise "$new_cargo_version"
|
||||
cargo update -p pow-core --precise "$new_cargo_version"
|
||||
cargo update -p metrics --precise "$new_cargo_version"
|
||||
cargo update -p miner-telemetry --precise "$new_cargo_version"
|
||||
cargo update -p engine-cpu --precise "$new_cargo_version"
|
||||
cargo update -p engine-gpu-cuda --precise "$new_cargo_version"
|
||||
cargo update -p engine-gpu-opencl --precise "$new_cargo_version"
|
||||
cargo update -p engine-montgomery --precise "$new_cargo_version"
|
||||
|
||||
# Verify everything compiles correctly
|
||||
cargo check --workspace
|
||||
|
||||
# Commit changes
|
||||
git config user.name "${{ github.actor }}"
|
||||
git config user.email "${{ github.actor }}@users.noreply.github.com"
|
||||
|
||||
git add Cargo.toml Cargo.lock
|
||||
git commit -m "bump version to $NEW_TAG"
|
||||
git commit -m "bump version to $NEW_VERSION"
|
||||
git push origin "$branch_name"
|
||||
|
||||
# Prepare PR title and body
|
||||
PR_TITLE="Release $NEW_TAG"
|
||||
PR_BODY="Automated version bump for release $NEW_TAG.
|
||||
PR_TITLE="Release $NEW_VERSION"
|
||||
PR_BODY="Automated version bump for release $NEW_VERSION.
|
||||
|
||||
## Overview
|
||||
- Version bump: ${{ github.event.inputs.version_type }}
|
||||
@@ -164,11 +191,6 @@ jobs:
|
||||
## What changed
|
||||
- Updated version in Cargo.toml and Cargo.lock
|
||||
|
||||
## Validation
|
||||
- [ ] Version number is correct
|
||||
- [ ] All tests pass
|
||||
- [ ] Ready for release
|
||||
|
||||
Triggered by workflow run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
||||
|
||||
# Prepare labels
|
||||
|
||||
18
Cargo.lock
generated
18
Cargo.lock
generated
@@ -471,7 +471,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "engine-cpu"
|
||||
version = "0.1.0"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"hex",
|
||||
@@ -483,7 +483,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "engine-gpu-cuda"
|
||||
version = "0.1.0"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cust",
|
||||
@@ -502,7 +502,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "engine-gpu-opencl"
|
||||
version = "0.1.0"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"log",
|
||||
@@ -514,7 +514,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "engine-montgomery"
|
||||
version = "0.1.0"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"crypto-bigint",
|
||||
"engine-cpu",
|
||||
@@ -1131,7 +1131,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0"
|
||||
|
||||
[[package]]
|
||||
name = "metrics"
|
||||
version = "0.1.0"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"log",
|
||||
@@ -1161,7 +1161,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "miner-cli"
|
||||
version = "0.1.0"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"env_logger",
|
||||
@@ -1172,7 +1172,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "miner-service"
|
||||
version = "0.1.0"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"crossbeam-channel",
|
||||
@@ -1197,7 +1197,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "miner-telemetry"
|
||||
version = "0.1.0"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"futures 0.3.31",
|
||||
@@ -1478,7 +1478,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pow-core"
|
||||
version = "0.1.0"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"hex",
|
||||
|
||||
@@ -17,6 +17,7 @@ resolver = "2"
|
||||
edition = "2021"
|
||||
authors = ["Quantus Network"]
|
||||
description = "Quantus External Miner Workspace"
|
||||
version = "0.0.1"
|
||||
|
||||
[workspace.dependencies]
|
||||
anyhow = "1"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "engine-cpu"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
publish = false
|
||||
description = "CPU mining engine implementation for the Quantus External Miner"
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "engine-gpu-cuda"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
publish = false
|
||||
description = "CUDA-based GPU mining engine for the Quantus External Miner (placeholder crate)"
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "engine-gpu-opencl"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
publish = false
|
||||
description = "OpenCL-based GPU mining engine for the Quantus External Miner (placeholder crate)"
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "engine-montgomery"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
description = "Montgomery-optimized CPU mining engine for Quantus External Miner"
|
||||
|
||||
[lib]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "metrics"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
publish = false
|
||||
description = "Metrics and Prometheus exporter utilities for the Quantus External Miner"
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "miner-cli"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
publish = false
|
||||
description = "CLI binary to run the Quantus External Miner service"
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "miner-service"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
publish = false
|
||||
description = "Service layer: HTTP API, job orchestration, and engine abstraction for the Quantus External Miner"
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "miner-telemetry"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
publish = false
|
||||
description = "Telemetry client for Quantus External Miner (Polkadot SDK-compatible envelopes over WebSocket)"
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "pow-core"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
description = "Local QPoW math core for the Quantus external miner (reference + optimized paths)"
|
||||
license = "MIT OR Apache-2.0"
|
||||
keywords = ["bigint", "crypto", "pow", "qpow", "quantus"]
|
||||
|
||||
Reference in New Issue
Block a user