-
Notifications
You must be signed in to change notification settings - Fork 0
2.1.1 #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
2.1.1 #21
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
96f3dc0
correction cookiejar conflict
playmiel f2b3f6a
rename cookiejar
playmiel 405763d
feat: Updated to version 2.1.1 and added a workflow for automatic ta…
playmiel b220bfd
correction deadlock
playmiel 7a8fc9d
correction close transport
playmiel 9e4b821
correction and clang
playmiel c4f4495
correction sync version
playmiel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| name: Auto Tag on Version Bump | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - 'library.json' | ||
| - 'library.properties' | ||
| - 'src/HttpCommon.h' | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| check-and-tag: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 # full history needed for tag comparison | ||
|
|
||
| - name: Extract version from library.json | ||
| id: version | ||
| run: | | ||
| VERSION=$(jq -r '.version' library.json) | ||
| echo "version=${VERSION}" >> "$GITHUB_OUTPUT" | ||
| echo "Detected version: ${VERSION}" | ||
|
|
||
| - name: Verify version consistency across files | ||
| run: | | ||
| VERSION="${{ steps.version.outputs.version }}" | ||
| V_PROP=$(grep '^version=' library.properties | cut -d'=' -f2) | ||
| V_HDR=$(grep '#define ESP_ASYNC_WEB_CLIENT_VERSION' src/HttpCommon.h | sed -E 's/.*"([^"]+)".*/\1/') | ||
|
|
||
| MISMATCH=0 | ||
| if [[ "${VERSION}" != "${V_PROP}" ]]; then | ||
| echo "::error::Version mismatch: library.json=${VERSION} vs library.properties=${V_PROP}" | ||
| MISMATCH=1 | ||
| fi | ||
| if [[ "${VERSION}" != "${V_HDR}" ]]; then | ||
| echo "::error::Version mismatch: library.json=${VERSION} vs HttpCommon.h=${V_HDR}" | ||
| MISMATCH=1 | ||
| fi | ||
| if [[ $MISMATCH -ne 0 ]]; then | ||
| echo "::error::Fix version mismatches before tagging. Use: scripts/sync-version.sh <version>" | ||
| exit 1 | ||
| fi | ||
| echo "All 3 version sources agree: ${VERSION}" | ||
|
|
||
| - name: Check if tag already exists | ||
| id: tag_check | ||
| run: | | ||
| TAG="v${{ steps.version.outputs.version }}" | ||
| if git rev-parse "refs/tags/${TAG}" >/dev/null 2>&1; then | ||
| echo "exists=true" >> "$GITHUB_OUTPUT" | ||
| echo "Tag ${TAG} already exists — skipping." | ||
| else | ||
| echo "exists=false" >> "$GITHUB_OUTPUT" | ||
| echo "Tag ${TAG} does not exist — will create." | ||
| fi | ||
|
|
||
| - name: Create and push tag | ||
| if: steps.tag_check.outputs.exists == 'false' | ||
| run: | | ||
| TAG="v${{ steps.version.outputs.version }}" | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
| git tag -a "${TAG}" -m "Release ${TAG}" | ||
| git push origin "${TAG}" | ||
| echo "::notice::Created and pushed tag ${TAG}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| #!/usr/bin/env bash | ||
| # sync-version.sh — Update version in all 3 source-of-truth files at once. | ||
| # Usage: ./scripts/sync-version.sh 2.2.0 | ||
| set -euo pipefail | ||
|
|
||
| if [[ $# -ne 1 ]]; then | ||
| echo "Usage: $0 <version>" | ||
| echo "Example: $0 2.2.0" | ||
| exit 1 | ||
| fi | ||
|
|
||
| NEW_VERSION="$1" | ||
|
|
||
| # Validate semver format | ||
| if [[ ! "${NEW_VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
| echo "Error: '${NEW_VERSION}' is not a valid semver (expected X.Y.Z)" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Syncing version to ${NEW_VERSION} across all files..." | ||
|
|
||
| # 1. library.json | ||
| if [[ -f library.json ]]; then | ||
| python3 - <<'PY' "${NEW_VERSION}" | ||
| import json | ||
| import sys | ||
|
|
||
| new_version = sys.argv[1] | ||
| path = "library.json" | ||
|
|
||
| with open(path, "r", encoding="utf-8") as f: | ||
| data = json.load(f) | ||
|
|
||
| if not isinstance(data, dict) or "version" not in data: | ||
| raise SystemExit("library.json missing top-level 'version' field") | ||
|
|
||
| data["version"] = new_version | ||
|
|
||
| with open(path, "w", encoding="utf-8", newline="\n") as f: | ||
| json.dump(data, f, indent=2, ensure_ascii=False) | ||
| f.write("\n") | ||
| PY | ||
| echo " ✓ library.json" | ||
| else | ||
playmiel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| echo " ✗ library.json not found (aborting)" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # 2. library.properties | ||
| if [[ -f library.properties ]]; then | ||
| python3 - <<'PY' "${NEW_VERSION}" | ||
| import re | ||
| import sys | ||
|
|
||
| new_version = sys.argv[1] | ||
| path = "library.properties" | ||
|
|
||
| with open(path, "r", encoding="utf-8") as f: | ||
| text = f.read() | ||
|
|
||
| updated, count = re.subn(r"^version=.*$", f"version={new_version}", text, flags=re.MULTILINE) | ||
| if count == 0: | ||
| raise SystemExit("library.properties missing 'version=' line") | ||
|
|
||
| with open(path, "w", encoding="utf-8", newline="\n") as f: | ||
| f.write(updated) | ||
| PY | ||
| echo " ✓ library.properties" | ||
| else | ||
| echo " ✗ library.properties not found (aborting)" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # 3. src/HttpCommon.h | ||
| if [[ -f src/HttpCommon.h ]]; then | ||
| python3 - <<'PY' "${NEW_VERSION}" | ||
| import re | ||
| import sys | ||
|
|
||
| new_version = sys.argv[1] | ||
| path = "src/HttpCommon.h" | ||
|
|
||
| with open(path, "r", encoding="utf-8") as f: | ||
| text = f.read() | ||
|
|
||
| pattern = r'#define ESP_ASYNC_WEB_CLIENT_VERSION "[^"]+"' | ||
| replacement = f'#define ESP_ASYNC_WEB_CLIENT_VERSION "{new_version}"' | ||
| updated, count = re.subn(pattern, replacement, text) | ||
| if count == 0: | ||
| raise SystemExit("src/HttpCommon.h missing ESP_ASYNC_WEB_CLIENT_VERSION define") | ||
|
|
||
| with open(path, "w", encoding="utf-8", newline="\n") as f: | ||
| f.write(updated) | ||
| PY | ||
| echo " ✓ src/HttpCommon.h" | ||
playmiel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| else | ||
| echo " ✗ src/HttpCommon.h not found (aborting)" >&2 | ||
| exit 1 | ||
| fi | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| echo "" | ||
| echo "Done! Version is now ${NEW_VERSION} everywhere." | ||
| echo "" | ||
| echo "Next steps:" | ||
| echo " 1. Update CHANGELOG.md with your changes under [${NEW_VERSION}]" | ||
| echo " 2. Commit and push to main" | ||
| echo " 3. The auto-tag workflow will create the tag v${NEW_VERSION} automatically" | ||
| echo " 4. The release workflow will generate the release with auto-generated notes" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.