Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
c233625
feat: release v0.1.1-alpha with new components and code refactoring (…
marc-romu Mar 3, 2025
a6d68c3
feat(ui): Enhance SmartHopper tab and About dialog appearance (#59)
marc-romu Mar 12, 2025
e8b68af
docs: Update version badge to 0.1.2-dev.250312 on dev
actions-user Mar 12, 2025
f19e8c2
docs: Update version badge to 0.1.2-dev.250312 on dev (#60)
marc-romu Mar 12, 2025
47b2250
ci(workflows): update GitHub Actions to latest secure versions
marc-romu Mar 16, 2025
2b0c89e
docs(changelog)
marc-romu Mar 16, 2025
4f1dab0
update version
marc-romu Mar 16, 2025
8238b69
ci(workflows): update GitHub Actions to latest secure versions (#61)
marc-romu Mar 16, 2025
ba2f228
docs: Update version badge to 0.1.2-alpha on main
actions-user Mar 16, 2025
9c0fbd3
docs: Update version badge to 0.1.2-alpha on main (#62)
marc-romu Mar 16, 2025
7cad444
Merge branch 'dev' into main->dev
marc-romu Mar 16, 2025
b4a569d
ci(workflows): update github actions versions (#63)
marc-romu Mar 16, 2025
021de14
ci(workflow): new security patch release workflow
marc-romu Mar 16, 2025
f06c1f5
ci(workflow): correct error when no changes to commit in security-pat…
marc-romu Mar 16, 2025
0a20088
ci(workflow): added new specific tools for version calculation and ch…
marc-romu Mar 16, 2025
fc57bd8
fix(workflow): update-badge was modifying all badges, not only the ve…
marc-romu Mar 16, 2025
486af2d
ci(workflow): updated pull-request-validation.yml workflow to use ver…
marc-romu Mar 16, 2025
013dbcf
fix(workflow): update-version-badges
marc-romu Mar 16, 2025
5c88c72
fix(workflow): update-badges with duplicated
marc-romu Mar 16, 2025
8c31423
fix(workflow): update-badge simplification
marc-romu Mar 16, 2025
f38b2f2
ci(workflow): update-dev-version-date will create a PR instead of com…
marc-romu Mar 16, 2025
7346c67
fix: update security-patch-release workflow to use PR-based approach
marc-romu Mar 16, 2025
c395024
docs: update GitHub Actions readme file
marc-romu Mar 16, 2025
243c44f
fix(workflow)
marc-romu Mar 16, 2025
bcd5540
fix(workflow): security-patch-release.yml error when branch already e…
marc-romu Mar 16, 2025
0db9a25
fix(workflow): version-tools always increment when specified
marc-romu Mar 16, 2025
3deba35
fix(workflows): ensure proper release draft timing in security patches
marc-romu Mar 16, 2025
d5094fe
fix(workflow)
marc-romu Mar 16, 2025
511c18e
fix(workflow): remove v before tagname in security releases
marc-romu Mar 16, 2025
3a9bdad
fix(workflow)
marc-romu Mar 16, 2025
1ea0304
fix(workflow): removed update_changelog parameter from security-patch…
marc-romu Mar 16, 2025
9742c18
refactor(workflow): Refactor changelog-updater action
marc-romu Mar 17, 2025
df05851
fix: avoid removing last release header
marc-romu Mar 17, 2025
2fb86ef
feat(workflow): added PR check in security-patch-release
marc-romu Mar 17, 2025
c609b3b
security: bump version to 0.1.2-alpha for security patch
actions-user Mar 17, 2025
18b73ac
security: release security patch v0.1.2-alpha (#72)
marc-romu Mar 17, 2025
0d869fd
Revert "security: release security patch v0.1.2-alpha"
marc-romu Mar 17, 2025
f363385
Revert "security: release security patch v0.1.2-alpha" (#73)
marc-romu Mar 17, 2025
8f7448a
security: bump version to 0.1.2-alpha for security patch
actions-user Mar 17, 2025
fa15ca8
security: release security patch v0.1.2-alpha (#74)
marc-romu Mar 17, 2025
98d63c8
refactor: reorganization of workflows and actions
marc-romu Mar 17, 2025
a4275df
Merge branch 'main' of https://github.com/architects-toolkit/SmartHopper
marc-romu Mar 17, 2025
2535402
fix: move back workflows to main folder to be recognized by github
marc-romu Mar 17, 2025
39796f1
feat: update release-build to actually build the project on publishin…
marc-romu Mar 17, 2025
0b69c33
chore(workflow): release-build
marc-romu Mar 17, 2025
b70dec8
chore: add GenerateResourceUsePreserializedResources tag in csproj fi…
marc-romu Mar 17, 2025
2c8ce1e
chore: join build file into a zip file
marc-romu Mar 17, 2025
9dab0da
chore(workflow): fix issue with output path
marc-romu Mar 17, 2025
ae7ce42
chore(workflow): fix warning in Upload Release Asset
marc-romu Mar 17, 2025
dd30a11
chore(build-release): create platform-specific zip files for Rhino8 W…
marc-romu Mar 19, 2025
13f4fc3
Merge branch 'main' into dev
marc-romu Mar 19, 2025
4a7b15d
chore: update development version date to 0.1.3-dev.250319
actions-user Mar 19, 2025
a249d6f
chore: update development version date to 0.1.3-dev.250319 (#77)
marc-romu Mar 19, 2025
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
168 changes: 168 additions & 0 deletions .github/actions/version-tools/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
# Version Tools

A set of composite actions for managing versioning in the SmartHopper project.

## Overview

This directory contains several composite actions that help with various aspects of version management:

1. **Version Tools** (`action.yml`) - The main action for core version operations:
- `get-version`: Extract the current version from Solution.props
- `update-version`: Update the version in Solution.props
- `update-badge`: Update the version and status badges in README.md

2. **Version Calculator** (`version-calculator/action.yml`) - For calculating new versions based on semantic versioning rules:
- Supports multiple increment types: `patch`, `minor`, `major`, `date`, `auto-date`
- Automatically detects and updates dates in development versions when using `auto-date`
- Handles pre-release suffixes: `dev`, `alpha`, `beta`, `rc`, or removal

3. **Changelog Updater** (`changelog-updater/action.yml`) - For updating the CHANGELOG.md file:
- `create-release`: Creates a new release section from Unreleased content
- `add-line`: Adds a new line to a section in the Unreleased area
- Supports security fixes and issue references

## Usage Examples

### Getting the Current Version

```yaml
- name: Get current version
id: current-version
uses: ./.github/actions/version-tools
with:
task: get-version
```

### Calculating a New Version

```yaml
- name: Calculate new version
id: calculate-version
uses: ./.github/actions/version-tools/version-calculator
with:
version: ${{ steps.current-version.outputs.version }}
increment: patch # Options: none, patch, minor, major, date, auto-date
change-pre-release: none # Options: none, dev, alpha, beta, rc, remove
```

### Auto-updating Date in Development Versions

```yaml
- name: Auto-update version date if needed
id: update-date
uses: ./.github/actions/version-tools/version-calculator
with:
version: ${{ steps.current-version.outputs.version }}
increment: auto-date
```

### Changing Pre-release Type

```yaml
- name: Change to beta release
id: change-to-beta
uses: ./.github/actions/version-tools/version-calculator
with:
version: ${{ steps.current-version.outputs.version }}
increment: none
change-pre-release: beta
```

### Updating the Version in Solution.props

```yaml
- name: Update version
uses: ./.github/actions/version-tools
with:
task: update-version
new-version: ${{ steps.calculate-version.outputs.new-version }}
```

### Updating Badges in README.md

```yaml
- name: Update badges
id: update-badge
uses: ./.github/actions/version-tools
with:
task: update-badge
```

### Adding a Line to CHANGELOG.md

```yaml
- name: Add security fix to CHANGELOG.md
uses: ./.github/actions/version-tools/changelog-updater
with:
action: add-line
section: Security
description: "Fixed critical security vulnerability in XYZ component"
issue-number: 123 # Optional
```

### Creating a New Release in CHANGELOG.md

```yaml
- name: Update CHANGELOG.md with version changes
uses: ./.github/actions/version-tools/changelog-updater
with:
action: create-release
version: ${{ steps.calculate-version.outputs.new-version }}
```

## Action Inputs and Outputs

### Version Tools (Main Action)

**Inputs:**
- `task`: (required) One of `get-version`, `update-version`, `update-badge`
- `new-version`: (required for update-version) New version to set
- `branch`: (optional) Branch name for context

**Outputs:**
- `version`: Current version from Solution.props
- `major`, `minor`, `patch`, `suffix`: Version components
- `badges-changed`: Whether badges were changed

### Version Calculator

**Inputs:**
- `version`: (required) Input version in format X.X.X or X.X.X-suffix.YYMMDD
- `increment`: (required) Type of increment:
- `none`: No increment, only apply other changes
- `patch`: Increment patch version
- `minor`: Increment minor version
- `major`: Increment major version
- `date`: Explicitly update the date part of a pre-release version
- `auto-date`: Auto-detect if this is a dated version and update it if needed
- `change-pre-release`: (optional) Change or add pre-release suffix:
- `none`: No change to pre-release suffix (default)
- `dev`: Change to development pre-release
- `alpha`: Change to alpha pre-release
- `beta`: Change to beta pre-release
- `rc`: Change to release candidate
- `remove`: Remove pre-release suffix entirely
- `pre-release-date`: (optional) Date to use for pre-release in format YYMMDD

**Outputs:**
- `new-version`: Calculated new version
- `is-prerelease`: Whether the calculated version is a pre-release
- `was-date-updated`: Whether the date was updated in a development version
- `major`, `minor`, `patch`, `suffix`: Version components

### Changelog Updater

**Inputs:**
- `action`: (required) Action to perform on the changelog:
- `create-release`: Create a new release section from Unreleased content
- `add-line`: Add a new line to a section in the Unreleased area
- `version`: (required for create-release) Version to add to changelog
- `date`: (optional) Release date (defaults to today)
- `section`: (required for add-line) Section to add the line to (Added, Changed, Deprecated, Removed, Fixed, Security)
- `description`: (required for add-line) Description to add as a new line
- `issue-number`: (optional for add-line) Issue number to reference in the new line
- `changelog-path`: (optional) Path to CHANGELOG.md file

**Outputs:**
- `updated`: Whether the changelog was updated
- `unreleased-content`: Content that was in the Unreleased section
176 changes: 176 additions & 0 deletions .github/actions/version-tools/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
name: 'Version Tools'
description: 'Common tools for version management in SmartHopper'
inputs:
task:
description: 'Task to perform'
required: true
type: choice
options:
- get-version
- update-version
- update-badge
new-version:
description: 'New version to set (only for update-version task)'
required: false
branch:
description: 'Branch name (for context)'
required: false
default: ''

outputs:
version:
description: 'Current version from Solution.props'
value: ${{ steps.get-version.outputs.version }}
major:
description: 'Major version component'
value: ${{ steps.parse-version.outputs.major }}
minor:
description: 'Minor version component'
value: ${{ steps.parse-version.outputs.minor }}
patch:
description: 'Patch version component'
value: ${{ steps.parse-version.outputs.patch }}
suffix:
description: 'Version suffix (if any)'
value: ${{ steps.parse-version.outputs.suffix }}
badges-changed:
description: 'Whether badges were changed'
value: ${{ steps.update-badge.outputs.badges-changed || 'false' }}

runs:
using: "composite"
steps:
- name: Get version from Solution.props
id: get-version
if: inputs.task == 'get-version' || inputs.task == 'update-version' || inputs.task == 'update-badge'
shell: bash
run: |
VERSION=$(grep -oP '(?<=<SolutionVersion>)[^<]+' Solution.props)
echo "Current version: $VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT

- name: Parse version components
id: parse-version
if: inputs.task == 'get-version' || inputs.task == 'update-version'
shell: bash
run: |
VERSION="${{ steps.get-version.outputs.version }}"
if [[ $VERSION =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)(-[a-zA-Z0-9]+(\.[0-9]+)?)?$ ]]; then
MAJOR="${BASH_REMATCH[1]}"
MINOR="${BASH_REMATCH[2]}"
PATCH="${BASH_REMATCH[3]}"
SUFFIX="${BASH_REMATCH[4]}"

echo "Parsed version: Major=$MAJOR, Minor=$MINOR, Patch=$PATCH, Suffix=$SUFFIX"
echo "major=$MAJOR" >> $GITHUB_OUTPUT
echo "minor=$MINOR" >> $GITHUB_OUTPUT
echo "patch=$PATCH" >> $GITHUB_OUTPUT
echo "suffix=$SUFFIX" >> $GITHUB_OUTPUT
else
echo "Error: Version format does not follow semantic versioning."
exit 1
fi

- name: Update version in Solution.props
id: update-version
if: inputs.task == 'update-version'
shell: bash
run: |
if [[ -z "${{ inputs.new-version }}" ]]; then
echo "Error: new-version input is required for update-version task"
exit 1
fi

echo "Updating version from ${{ steps.get-version.outputs.version }} to ${{ inputs.new-version }}"
sed -i "s/<SolutionVersion>.*<\/SolutionVersion>/<SolutionVersion>${{ inputs.new-version }}<\/SolutionVersion>/" Solution.props
echo "Updated Solution.props with new version: ${{ inputs.new-version }}"

- name: Update version badge in README.md
id: update-badge
if: inputs.task == 'update-badge' || inputs.task == 'update-version'
shell: bash
run: |
# Get the current version (either the updated one or the original)
if [[ "${{ inputs.task }}" == "update-version" ]]; then
VERSION="${{ inputs.new-version }}"
else
VERSION="${{ steps.get-version.outputs.version }}"
fi

# Format version for shields.io by encoding special characters
ENCODED_VERSION=$(echo "$VERSION" | sed 's/-/--/g' | sed 's/\./%2E/g')

# Determine color and status based on version
if [[ $VERSION == *"-dev"* ]]; then
COLOR="blue"
STATUS="Development"
elif [[ $VERSION == *"-alpha"* ]]; then
COLOR="orange"
STATUS="Alpha"
elif [[ $VERSION == *"-beta"* ]]; then
COLOR="yellow"
STATUS="Beta"
elif [[ $VERSION == *"-rc"* ]]; then
COLOR="yellowgreen"
STATUS="Release Candidate"
else
COLOR="brightgreen"
STATUS="Stable"
fi

# Create new badge URLs
VERSION_BADGE_URL="https://img.shields.io/badge/version-$ENCODED_VERSION-$COLOR"
STATUS_BADGE_URL="https://img.shields.io/badge/status-$STATUS-$COLOR"

# Create badge markdown
VERSION_BADGE="[![Version]($VERSION_BADGE_URL)](https://github.com/architects-toolkit/SmartHopper/releases)"
STATUS_BADGE="[![Status]($STATUS_BADGE_URL)](https://github.com/architects-toolkit/SmartHopper/releases)"

# Update README.md with new badges
if [[ -f "README.md" ]]; then
BADGES_CHANGED=false

# Check if version badge exists and update it
if grep -q "\[\!\[Version\]\]" README.md; then
# Get current version badge
CURRENT_VERSION_BADGE=$(grep "\[\!\[Version\]\]" README.md)

# Check if badge needs updating
if [[ "$CURRENT_VERSION_BADGE" != "$VERSION_BADGE" ]]; then
# Use sed to replace the version badge
sed -i "s|\[\!\[Version\]\](https://img\.shields\.io/badge/version[^)]*)|[![Version]($VERSION_BADGE_URL)|g" README.md
echo "Updated version badge"
BADGES_CHANGED=true
else
echo "Version badge already up to date"
fi
fi

# Check if status badge exists and update it
if grep -q "\[\!\[Status\]\]" README.md; then
# Get current status badge
CURRENT_STATUS_BADGE=$(grep "\[\!\[Status\]\]" README.md)

# Check if badge needs updating
if [[ "$CURRENT_STATUS_BADGE" != "$STATUS_BADGE" ]]; then
# Use sed to replace the status badge
sed -i "s|\[\!\[Status\]\](https://img\.shields\.io/badge/status[^)]*)|[![Status]($STATUS_BADGE_URL)|g" README.md
echo "Updated status badge"
BADGES_CHANGED=true
else
echo "Status badge already up to date"
fi
fi

# Check if badges were changed
if [ "$BADGES_CHANGED" = true ]; then
echo "README.md badges were updated"
echo "badges-changed=true" >> $GITHUB_OUTPUT
else
echo "No changes to README.md badges"
echo "badges-changed=false" >> $GITHUB_OUTPUT
fi
else
echo "README.md not found, skipping badge update"
echo "badges-changed=false" >> $GITHUB_OUTPUT
fi
Loading
Loading