Compare commits

...

38 Commits

Author SHA1 Message Date
GitHub Actions
7f1c362a50 Bump version to 2024.12.3 [skip-versioning] 2024-12-21 17:09:47 +00:00
Edward Firmo
cf3018c95c Merge pull request #49 from edwardtfn/new-versioning-03
Fix verison validation
2024-12-21 18:09:37 +01:00
Edward Firmo
360ae3123a Update bump_version.sh 2024-12-21 18:06:00 +01:00
Edward Firmo
6767b5e765 Fix version validation 2024-12-21 18:00:46 +01:00
Edward Firmo
d5e5ebb3d6 Fix version format 2024-12-21 17:52:33 +01:00
Edward Firmo
46c04eb992 Merge pull request #46 from edwardtfn/new-versioning-03
Rollback to the last working point
2024-12-21 17:50:34 +01:00
Edward Firmo
8558bc3650 Merge branch 'main' into new-versioning-03 2024-12-21 17:49:58 +01:00
Edward Firmo
f32e2eee4f Add quotes around file path in cat command
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2024-12-21 17:14:00 +01:00
Edward Firmo
5a993165cd Rollback to the last working point 2024-12-21 14:54:47 +01:00
Edward Firmo
d04c2aff2f Merge pull request #45 from edwardtfn/new-versioning-02
Use an automation branch
2024-12-21 14:14:00 +01:00
Edward Firmo
2d79ee42c7 Quote variables and url 2024-12-21 14:05:37 +01:00
Edward Firmo
3f4fc7a505 Quote GitHub token in push command
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2024-12-21 13:55:26 +01:00
Edward Firmo
be23a5a0fd Quote variables in temporary branch creation
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2024-12-21 13:54:51 +01:00
Edward Firmo
a23a2db352 Fix invalid YAML structure in push trigger
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2024-12-21 13:35:12 +01:00
Edward Firmo
4e73a11528 Use an automation branch 2024-12-21 13:27:58 +01:00
Edward Firmo
3c98d81bb7 Merge pull request #44 from edwardtfn/new-versioning-01
No leading zero on versions
2024-12-21 12:31:30 +01:00
Edward Firmo
e63447984d Remove duplicated version validation 2024-12-21 12:26:05 +01:00
Edward Firmo
1f1a8049e6 No leading zero on versions 2024-12-21 12:23:32 +01:00
Edward Firmo
0dddc0747b Merge pull request #43 from edwardtfn/test-new-versioning-04
Describe file
2024-12-21 11:55:06 +01:00
Edward Firmo
86d1513c6a Describe file 2024-12-21 11:54:42 +01:00
GitHub Actions
ac4d583b64 Bump version to 2024.12.01 2024-12-21 10:37:03 +00:00
Edward Firmo
15830d4134 Merge pull request #42 from edwardtfn/test-new-versioning-03
Fix repo name
2024-12-21 11:27:19 +01:00
Edward Firmo
0c19ca1205 Fix repo name 2024-12-21 11:26:57 +01:00
Edward Firmo
2d676036dc Merge pull request #41 from edwardtfn/test-new-versioning-02
New approach to GitHub tokens
2024-12-21 11:20:35 +01:00
Edward Firmo
c8ffa9e224 New approach to GitHub tokens 2024-12-21 11:20:13 +01:00
Edward Firmo
1406ada53a Merge pull request #40 from edwardtfn/test-new-versioning
Testing new versioning
2024-12-21 11:13:58 +01:00
Edward Firmo
f02f90c3fa Testing new versioning 2024-12-21 11:05:40 +01:00
Edward Firmo
f6169e3ea2 Merge branch 'main' of https://github.com/edwardtfn/TX-Ultimate-Easy 2024-12-21 11:01:47 +01:00
Edward Firmo
6774a1ac18 Set initial version number 2024-12-21 11:01:01 +01:00
Edward Firmo
21720d8ba3 Merge pull request #39 from edwardtfn/dev
New versioning
2024-12-21 10:58:41 +01:00
Edward Firmo
7727c968db Merge branch 'dev' of https://github.com/edwardtfn/TX-Ultimate-Easy into dev 2024-12-21 10:33:54 +01:00
Edward Firmo
dc9e19d43c Add section about version validation 2024-12-21 10:33:36 +01:00
Edward Firmo
737343e395 Add fetch-depth: 0 to checkout action
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2024-12-21 10:31:23 +01:00
Edward Firmo
5569260f92 Update checkout action version
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2024-12-21 10:30:28 +01:00
Edward Firmo
04ca752c3b Add error handling for git operations
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2024-12-21 10:29:46 +01:00
Edward Firmo
23436428a4 Add error handling for invalid version format
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2024-12-21 10:29:12 +01:00
Edward Firmo
26a244cbed Fix potential overflow in sequence number
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2024-12-21 10:28:14 +01:00
Edward Firmo
ce8b4e700e Merge pull request #38 from edwardtfn/0.0.5
Clean up LED files & new versioning
2024-12-21 10:18:49 +01:00
9 changed files with 101 additions and 61 deletions

View File

@@ -1,3 +1,11 @@
# This GitHub Actions workflow updates the "stable" and "latest" Git tags
# to point to the tag associated with a newly published release. It performs
# the following steps:
# 1. Checks out the repository code with full history.
# 2. Configures Git with a generic user for the action.
# 3. Moves and forcibly pushes the "stable" and "latest" tags to align with
# the tag of the newly published release.
# This ensures that "stable" and "latest" always point to the most recent release.
--- ---
name: Update Tags name: Update Tags

View File

@@ -1,11 +1,14 @@
# Workflow for managing versioning, tagging, and conditional updates # Workflow for managing versioning and tagging
--- ---
name: Bump Version and Tag name: Version Bump and Tag
on: # yamllint disable-line rule:truthy on: # yamllint disable-line rule:truthy
push: push:
branches: branches:
- main - main
paths-ignore:
- '**/VERSION'
- '**/VERSION_YAML'
workflow_dispatch: workflow_dispatch:
inputs: inputs:
update_stable: update_stable:
@@ -18,7 +21,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: "actions/checkout@v4"
- name: Set up Git - name: Set up Git
run: | run: |
@@ -27,19 +30,13 @@ jobs:
- name: Bump Version - name: Bump Version
run: | run: |
chmod +x ./versioning/bump_version.sh chmod +x "./versioning/bump_version.sh"
./versioning/bump_version.sh "./versioning/bump_version.sh"
- name: Push Changes and Tags - name: Push Changes and Tags
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: | run: |
git push origin main git push "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" main
git push origin --tags --force git push "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" --tags
- name: Conditionally Update Stable Tag
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.update_stable == 'true' }}
run: |
git tag -f stable
git push origin stable --force
... ...

BIN
Assets/Logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB

View File

@@ -15,11 +15,7 @@ substitutions:
name: tx-ultimate-easy name: tx-ultimate-easy
friendly_name: TX Ultimate Easy friendly_name: TX Ultimate Easy
latitude: '0' <<: !include ../versioning/VERSION_YAML
longitude: '0'
zone_home: 'zone.home'
version: '0.0.4'
TX_MODEL_FORMAT_EU_TEXT: "EU (Square, T5-xC-86)" TX_MODEL_FORMAT_EU_TEXT: "EU (Square, T5-xC-86)"
TX_MODEL_FORMAT_US_TEXT: "US (Rectangle, T5-xC-120)" TX_MODEL_FORMAT_US_TEXT: "US (Rectangle, T5-xC-120)"

View File

@@ -98,6 +98,7 @@ async def register_tx_ultimate_easy(var, config):
config[CONF_ON_LONG_TOUCH_RELEASE], config[CONF_ON_LONG_TOUCH_RELEASE],
) )
async def to_code(config): async def to_code(config):
var = cg.new_Pvariable(config[CONF_ID]) var = cg.new_Pvariable(config[CONF_ID])
await cg.register_component(var, config) await cg.register_component(var, config)

View File

@@ -2,34 +2,28 @@
## Overview ## Overview
This project uses a time-based versioning scheme: `year.month.sequential_number`. This project uses a time-based versioning scheme: `year.month.sequential_number`.
This scheme makes it easy to identify when a version was released and provides a clear order for releases within a given month. The system automates version updates and tagging to ensure consistent, conflict-free management of releases.
### Examples ### Examples
- `2024.12.01` First release of December 2024. - `2024.1.1` First release of January 2024.
- `2024.12.02` Second release of December 2024. - `2024.12.2` Second release of December 2024.
- `2025.01.01` First release of January 2025.
## Files ## How It Works
- **`VERSION`**: Contains the current version of the project as plain text. 1. **Temporary Branch Creation**: A unique branch is created for each workflow run.
- **`bump_version.sh`**: A script to increment the version based on the current date and release sequence. 2. **Version Update**: The workflow updates the `VERSION` and `VERSION_YAML` files using the current date and release sequence.
- **`README.md`**: Documentation for the versioning process. 3. **Commit with Marker**: Changes are committed with a `[skip-versioning]` marker to prevent triggering the workflow again.
4. **Merge into Main**: The temporary branch is merged into `main`.
## Versioning Rules 5. **Branch Cleanup**: The temporary branch is deleted after merging.
1. The version format is `YYYY.MM.NN`, where:
- `YYYY` is the current year.
- `MM` is the current month (two digits).
- `NN` is the sequential release number within the month (starting at `01`).
2. On each new merge to the `main` branch:
- If the month hasnt changed, the sequential number (`NN`) is incremented.
- If the month has changed, the sequential number resets to `01`.
## Usage ## Usage
### Automatically Managed ### Automated Workflow
The versioning process is fully integrated into the workflow. Developers do not need to manually increment or manage versions. The versioning process is fully automated:
Simply push your changes, and the system will handle version updates and tagging automatically. - Developers submit their changes as usual.
- The workflow handles version updates, tagging, and integration into `main`.
- No manual intervention is needed for versioning.
### Access Version in Code ### Accessing the Version in Code
The version is accessible in the ESPHome YAML configuration file (`TX-Ultimate-Easy-ESPHome_core.yaml`) using the following syntax: The version is accessible in the ESPHome YAML configuration file (`TX-Ultimate-Easy-ESPHome_core.yaml`) using the following syntax:
```yaml ```yaml
@@ -37,19 +31,46 @@ substitutions:
version: <<: !include ../versioning/VERSION version: <<: !include ../versioning/VERSION
``` ```
This ensures the correct version is used directly in the ESPHome setup without requiring manual updates. This ensures the correct version is dynamically included in the ESPHome setup.
## Benefits of this Versioning Approach ## Benefits
1. **Clarity**: Each version is tied to a specific point in time, making it easy to track releases. - **Clarity**: Easily track when a release occurred with meaningful version numbers.
2. **Automation**: The process is seamless and reduces manual effort. - **Automation**: Eliminates manual version management.
3. **Scalability**: Supports frequent releases while keeping the versioning system organized. - **Scalability**: Supports frequent updates and concurrent workflows.
4. **Traceability**: Git tags and the `VERSION` file ensure releases are well-documented and easily accessible. - **Traceability**: Maintains a clear history of changes through Git tags and version files.
## System Details
### Version Format
The format `year.month.sequential_number` includes:
- `year` (YYYY): A 4-digit number representing the year.
- `month` (M): A number from 1 to 12 (no leading zeros).
- `sequential_number`: A positive number incremented with each release in the same month.
### Validation Rules
The `bump_version.sh` script enforces strict validation:
- Year must be a 4-digit number.
- Month must be 112 without leading zeros.
- Sequence must be a positive number without leading zeros.
If validation fails, the workflow stops and provides an error message.
### GitHub Workflow
The workflow is triggered automatically when:
- Changes are pushed to `main`.
- Developers trigger it manually using the `workflow_dispatch` event.
The workflow avoids infinite loops by committing changes with the `[skip-versioning]` marker.
## Extending the System ## Extending the System
- Add more scripts to handle additional automation tasks, such as generating changelogs or notifying stakeholders of new releases. Consider extending the system to:
- Enhance the `bump_version.sh` script to support different versioning schemes if needed. - Automatically generate release notes or changelogs.
- Integrate versioning information into your deployment pipelines to label builds with their corresponding version. - Notify stakeholders when a new version is released.
- Integrate versioning information into deployment pipelines.
### GitHub Actions Workflow Adjustment ## FAQ
The GitHub Actions workflow for versioning runs only when changes are merged into the `main` branch, ensuring no premature version updates during PR creation. **Q: What happens if two workflows run concurrently?**
This behavior is automatically handled by the integrated workflow. A: Each workflow operates in its own temporary branch, avoiding conflicts.
**Q: Can I manually update the version?**
A: Manual updates are not needed. The workflow ensures accurate, automated versioning.

1
versioning/VERSION Normal file
View File

@@ -0,0 +1 @@
2024.12.3

1
versioning/VERSION_YAML Normal file
View File

@@ -0,0 +1 @@
version: 2024.12.3

View File

@@ -5,14 +5,20 @@ VERSION_YAML_FILE="./versioning/VERSION_YAML"
# Read the current version # Read the current version
if [ -f "$VERSION_FILE" ]; then if [ -f "$VERSION_FILE" ]; then
CURRENT_VERSION=$(cat $VERSION_FILE) CURRENT_VERSION=$(cat "$VERSION_FILE")
else else
CURRENT_VERSION="0.0.0" # Default if file doesn't exist CURRENT_VERSION="0.0.0" # Default if file doesn't exist
fi fi
# Validate the current version format
if ! [[ "$CURRENT_VERSION" =~ ^[0-9]{4}\.[0-9]{1,2}\.[0-9]+$ ]]; then
echo "Error: Invalid version format in $VERSION_FILE"
exit 1
fi
# Extract components # Extract components
CURRENT_YEAR=$(date +%Y) CURRENT_YEAR=$(date +%Y)
CURRENT_MONTH=$(date +%m) CURRENT_MONTH=$(date +%-m) # Avoid leading zero for the month
CURRENT_SEQ=$(echo "$CURRENT_VERSION" | awk -F. '{print $3}') CURRENT_SEQ=$(echo "$CURRENT_VERSION" | awk -F. '{print $3}')
VERSION_YEAR=$(echo "$CURRENT_VERSION" | awk -F. '{print $1}') VERSION_YEAR=$(echo "$CURRENT_VERSION" | awk -F. '{print $1}')
@@ -20,12 +26,12 @@ VERSION_MONTH=$(echo "$CURRENT_VERSION" | awk -F. '{print $2}')
# Determine new version # Determine new version
if [[ "$CURRENT_YEAR" == "$VERSION_YEAR" && "$CURRENT_MONTH" == "$VERSION_MONTH" ]]; then if [[ "$CURRENT_YEAR" == "$VERSION_YEAR" && "$CURRENT_MONTH" == "$VERSION_MONTH" ]]; then
NEW_SEQ=$(printf "%02d" $((10#$CURRENT_SEQ + 1))) # Increment sequence NEXT_SEQ=$((CURRENT_SEQ + 1))
else else
NEW_SEQ="01" # Reset sequence for a new month NEXT_SEQ=1 # Reset sequence for a new month
fi fi
NEW_VERSION="${CURRENT_YEAR}.${CURRENT_MONTH}.${NEW_SEQ}" NEW_VERSION="${CURRENT_YEAR}.${CURRENT_MONTH}.${NEXT_SEQ}"
# Update the plain text VERSION file # Update the plain text VERSION file
echo "$NEW_VERSION" > "$VERSION_FILE" echo "$NEW_VERSION" > "$VERSION_FILE"
@@ -34,6 +40,15 @@ echo "$NEW_VERSION" > "$VERSION_FILE"
echo "version: $NEW_VERSION" > "$VERSION_YAML_FILE" echo "version: $NEW_VERSION" > "$VERSION_YAML_FILE"
# Commit and tag # Commit and tag
git add "$VERSION_FILE" "$VERSION_YAML_FILE" if ! git add "$VERSION_FILE" "$VERSION_YAML_FILE"; then
git commit -m "Bump version to $NEW_VERSION" echo "Error: Failed to stage version files"
git tag "v$NEW_VERSION" exit 1
fi
if ! git commit -m "Bump version to $NEW_VERSION [skip-versioning]"; then
echo "Error: Failed to commit version bump"
exit 1
fi
if ! git tag "v$NEW_VERSION"; then
echo "Error: Failed to create version tag"
exit 1
fi