feature/1220 origin handle exists method (#1243)

* feat: add docs and CI workflow for publishing to onsonr.dev

* (refactor): Move hway,motr executables to their own repos

* feat: simplify devnet and testnet configurations

* refactor: update import path for didcrypto package

* docs(networks): Add README with project overview, architecture, and community links

* refactor: Move network configurations to deploy directory

* build: update golang version to 1.23

* refactor: move logger interface to appropriate package

* refactor: Move devnet configuration to networks/devnet

* chore: improve release process with date variable

* (chore): Move Crypto Library

* refactor: improve code structure and readability in DID module

* feat: integrate Trunk CI checks

* ci: optimize CI workflow by removing redundant build jobs

* feat: integrate Trunk CI checks, simplify devnet and testnet configurations, add docs and CI for onsonr.dev publishing, automate releases using Taskfile and GitHub Actions, and add Reddit release notification

* ci: Trigger release validation on pull requests

* ci: Migrate GoReleaser configuration to Makefiles

* chore: update CI workflow permissions and rename job

* refactor: remove unnecessary docker push steps from release process

* feat: automate release process using Taskfile and GitHub Actions

* fix: change shebang from bash to sh

* chore: update setup script shebang to bash

* chore: remove unnecessary setup-env step from release process

* test: improve test descriptions and naming for clarity

* refactor: rename workflow files for clarity

* refactor: rename post-merge workflow file

* refactor: Move race and coverage tests to separate workflow

* refactor: simplify merge group trigger

* chore: prevent accidental release overwriting of existing tags

* test: rename GoReleaser Dry Run step to GoReleaser Test

* fix: correct GitHub Actions workflow for version bumping

* fix: Correct tag validation in CI workflow

* refactor: simplify GitHub Actions workflow for version checking

* test: replace version check with make command

* chore: update setup-python action to v5

* test: rename workflow job and remove unnecessary steps

* feat: enable workflow on merge group events

---------

Signed-off-by: Prad Nukala <prad@sonr.io>
Co-authored-by: Darp Alakun <i@prad.nu>
This commit is contained in:
Prad Nukala
2025-01-06 14:00:11 -05:00
committed by GitHub
co-authored by root
parent 2f65b1c283
commit 7f3aa01bd5
10 changed files with 154 additions and 115 deletions
+8 -50
View File
@@ -1,7 +1,5 @@
#!/bin/bash
set -e
ROOT_DIR=$(git rev-parse --show-toplevel)
# Function to install a Go binary if it doesn't exist
@@ -12,57 +10,17 @@ function go_install() {
fi
}
# Function to install a Cargo binary if it doesn't exist
function cargo_install() {
if ! command -v "$1" &>/dev/null; then
echo "Installing $1..."
cargo install "$1"
fi
}
# Function to install a uv tool if it doesn't exist
function uv_install() {
if ! command -v "$1" &>/dev/null; then
echo "Installing $1..."
uv tool install "$1" --force
fi
}
# Function to initialize git credentials
function set_git() {
git config --global user.name "Darp Alakun"
git config --global user.email "i@prad.nu"
# Check if the GITHUB_TOKEN is set then authenticate with it if not ignore
if [[ -z ${GITHUB_TOKEN} ]]; then
echo "GITHUB_TOKEN is not set. Please set it before running this script."
exit 1
else
gh auth login --with-token <<<"${GITHUB_TOKEN}"
fi
}
function get_deps() {
go_install go-task/task/v3/cmd/task@latest
go_install x-motemen/ghq@latest
go_install a-h/templ/cmd/templ@latest
cargo_install ripgrep
cargo_install fd-find
cargo_install eza
uv_install aider-chat
}
function clone_repos() {
ghq get github.com/onsonr/sonr
ghq get github.com/onsonr/nebula
ghq get github.com/onsonr/hway
# Function to install a gh extension if it doesn't exist. Check gh <extension> for checking if installed
function gh_ext_install() {
gh extension install "$1"
}
function main() {
get_deps
set_git
go_install go-task/task/v3/cmd/task@latest
go_install a-h/templ/cmd/templ@latest
go_install goreleaser/goreleaser/v2@latest
gh_ext_install johnmanjiro13/gh-bump
}
main
+53
View File
@@ -0,0 +1,53 @@
#!/bin/bash
set -e # Exit on any error
# Function to compare version strings
version_gt() {
test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"
}
# Install commitizen if not present
if ! command -v cz &> /dev/null; then
echo "Installing commitizen..."
pip install --user commitizen
fi
# Get all tags and sort them by version
echo "Fetching all tags..."
git fetch --tags --force
TAGS=$(git tag -l "v*" | sort -V)
LATEST_TAG=$(echo "$TAGS" | tail -n1)
if [ -z "$LATEST_TAG" ]; then
echo "No tags found"
exit 1
fi
echo "Latest tag: $LATEST_TAG"
# Run commitizen to determine next version
echo "Running commitizen bump --dry-run..."
NEXT_VERSION=$(cz bump --dry-run --increment=patch 2>&1 | grep "tag to create: v" | cut -d "v" -f2)
if [ -z "$NEXT_VERSION" ]; then
echo "Failed to determine next version"
exit 1
fi
echo "Next version determined by commitizen: v$NEXT_VERSION"
# Check if the next version already exists
if echo "$TAGS" | grep -q "v$NEXT_VERSION"; then
echo "ERROR: Version v$NEXT_VERSION already exists!"
exit 1
fi
# Verify the next version is actually greater than the latest
if ! version_gt "$NEXT_VERSION" "${LATEST_TAG#v}"; then
echo "ERROR: Next version v$NEXT_VERSION is not greater than current version $LATEST_TAG"
exit 1
fi
echo "✅ Version v$NEXT_VERSION is valid and does not exist yet"
exit 0