From 70a0a844825de2b20fc14e5c5bb50a94595da022 Mon Sep 17 00:00:00 2001 From: Cloud Agent Date: Tue, 3 Mar 2026 02:00:58 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9C=A8=20feat(core):=20add=20inline=20re?= =?UTF-8?q?lease=20notes=20and=20update=20cicd=20workflows=20[patch=20cand?= =?UTF-8?q?idate]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release-controller.yml | 125 +++++++++++++++++------ .github/workflows/version-controller.yml | 26 +++-- 2 files changed, 110 insertions(+), 41 deletions(-) diff --git a/.github/workflows/release-controller.yml b/.github/workflows/release-controller.yml index ab89f77..2602e63 100644 --- a/.github/workflows/release-controller.yml +++ b/.github/workflows/release-controller.yml @@ -7,7 +7,6 @@ on: push: tags: - 'v[0-9]+.[0-9]+.[0-9]+' - - 'v*.*.*' permissions: contents: write @@ -19,30 +18,100 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') env: REPO_NAME: ${{ github.event.repository.name }} - # set folder repository var \ - # (settings->security->secrets-variables->actions->variables->repository) \ - # or set default - FOLDER_TO_COMPRESS: 'docs' + REPO_FULL: ${{ github.repository }} steps: - name: Checkout repository id: checkout_repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Set up Python 3.12 - id: setup_python - uses: actions/setup-python@v4 - with: - python-version: 3.12 - - name: Install dependencies - id: install_dependencies + - name: Generate Release Notes + id: release_notes run: | - python -m venv venv - source venv/bin/activate - pip install --upgrade pip - pip install poetry - poetry lock - poetry install + TAG="${GITHUB_REF_NAME}" + PREV_TAG=$(git describe --tags --abbrev=0 "${TAG}^" 2>/dev/null || echo "") + + if [ -z "$PREV_TAG" ]; then + COMMITS=$(git log "$TAG" --pretty=format:"%s") + else + COMMITS=$(git log "${PREV_TAG}..${TAG}" --pretty=format:"%s") + fi + + FEATURES="" + FIXES="" + DOCS="" + REFACTORS="" + PERF="" + CHORES="" + STYLES="" + TESTS="" + OTHER="" + + while IFS= read -r line; do + # Skip noise commits + case "$line" in + "Bump version:"*|"Merge branch"*|"Merge pull request"*) continue ;; + esac + + # Strip emoji prefix if present + clean=$(echo "$line" | sed 's/^[^a-zA-Z]* *//') + + # Parse conventional commit + if echo "$clean" | grep -qE '^(feat|fix|docs|style|refactor|perf|test|chore)(\([^)]+\))?:'; then + TYPE=$(echo "$clean" | sed -E 's/^(feat|fix|docs|style|refactor|perf|test|chore).*/\1/') + DESC=$(echo "$clean" | sed -E 's/^(feat|fix|docs|style|refactor|perf|test|chore)(\([^)]+\))?:\s*//') + # Remove versioning keyword suffix + DESC=$(echo "$DESC" | sed -E 's/\s*\[(minor|major|patch) candidate\]\s*$//') + SCOPE=$(echo "$clean" | sed -nE 's/^[a-z]+\(([^)]+)\):.*/\1/p') + + if [ -n "$SCOPE" ]; then + ENTRY="- **${SCOPE}**: ${DESC}" + else + ENTRY="- ${DESC}" + fi + + case "$TYPE" in + feat) FEATURES="${FEATURES}${ENTRY}\n" ;; + fix) FIXES="${FIXES}${ENTRY}\n" ;; + docs) DOCS="${DOCS}${ENTRY}\n" ;; + style) STYLES="${STYLES}${ENTRY}\n" ;; + refactor) REFACTORS="${REFACTORS}${ENTRY}\n" ;; + perf) PERF="${PERF}${ENTRY}\n" ;; + test) TESTS="${TESTS}${ENTRY}\n" ;; + chore) CHORES="${CHORES}${ENTRY}\n" ;; + esac + else + if [ -n "$clean" ]; then + OTHER="${OTHER}- ${clean}\n" + fi + fi + done <<< "$COMMITS" + + # Build release notes body + BODY="## What's Changed\n\n" + + [ -n "$FEATURES" ] && BODY="${BODY}### Features\n${FEATURES}\n" + [ -n "$FIXES" ] && BODY="${BODY}### Bug Fixes\n${FIXES}\n" + [ -n "$DOCS" ] && BODY="${BODY}### Documentation\n${DOCS}\n" + [ -n "$REFACTORS" ] && BODY="${BODY}### Refactors\n${REFACTORS}\n" + [ -n "$PERF" ] && BODY="${BODY}### Performance\n${PERF}\n" + [ -n "$STYLES" ] && BODY="${BODY}### Styles\n${STYLES}\n" + [ -n "$TESTS" ] && BODY="${BODY}### Tests\n${TESTS}\n" + [ -n "$CHORES" ] && BODY="${BODY}### Chores\n${CHORES}\n" + [ -n "$OTHER" ] && BODY="${BODY}### Other\n${OTHER}\n" + + if [ -n "$PREV_TAG" ]; then + BODY="${BODY}**Full Changelog**: https://github.com/${REPO_FULL}/compare/${PREV_TAG}...${TAG}\n" + fi + + # Write to output using delimiter + { + echo "body<> "$GITHUB_OUTPUT" + env: + REPO_FULL: ${{ env.REPO_FULL }} - name: Package Version id: package_version run: | @@ -50,28 +119,18 @@ jobs: {INSTALL,SECURITY,README,ICONS,CONTRIBUTING,CODE_OF_CONDUCT}.md \ requirements.txt .github scripts *adm* smtp-relay elastalert \ pyproject.toml -# "${FOLDER_TO_COMPRESS}" env: REPO_NAME: ${{ env.REPO_NAME }} GITHUB_REF_NAME: ${{ github.ref_name }} - FOLDER_TO_COMPRESS: ${{ env.FOLDER_TO_COMPRESS }} - name: Create GitHub Release id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: softprops/action-gh-release@v2 with: tag_name: ${{ github.ref_name }} - release_name: Release ${{ github.ref_name }} + name: Release ${{ github.ref_name }} + body: ${{ steps.release_notes.outputs.body }} draft: false prerelease: false - - name: Upload Release Asset - id: upload_release - uses: actions/upload-release-asset@v1 + files: "${{ env.REPO_NAME }}-${{ github.ref_name }}.zip" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: "${{ env.REPO_NAME }}-${{ github.ref_name }}.zip" - asset_name: "${{ env.REPO_NAME }}-${{ github.ref_name }}.zip" - asset_content_type: application/zip diff --git a/.github/workflows/version-controller.yml b/.github/workflows/version-controller.yml index 5df11a3..caecbc3 100644 --- a/.github/workflows/version-controller.yml +++ b/.github/workflows/version-controller.yml @@ -17,12 +17,12 @@ jobs: steps: - name: Checkout Repository id: checkout_repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Python id: setup_python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.12' - name: Install Dependencies @@ -61,18 +61,28 @@ jobs: run: | ls -la git submodule add --force -b ${{ steps.determine_branch.outputs.current_branch }} https://github.com/JuanVilla424/scripts.git -# - name: Run Changelog Generator -# id: run_changelog -# run: | -# python scripts/generate_changelog/main.py + - name: Run Changelog Generator + id: run_changelog + run: | + python scripts/generate_changelog/main.py + - name: Commit Changelog Updates + id: commit_changelog + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add CHANGELOG.md || true + git diff --cached --quiet || git commit -m "docs(core): update changelog" - name: Check for Forbidden Character id: check_arrow run: | - if [[ "${{ steps.get_commit.outputs.commit_message }}" == *"→"* && "${{ steps.get_commit.outputs.commit_message }}" == *"Bump version:"* ]]; then + COMMIT_MSG="${COMMIT_MESSAGE}" + if [[ "$COMMIT_MSG" == *"→"* && "$COMMIT_MSG" == *"Bump version:"* ]]; then echo "contains_arrow=true" >> $GITHUB_OUTPUT else echo "contains_arrow=false" >> $GITHUB_OUTPUT fi + env: + COMMIT_MESSAGE: ${{ steps.get_commit.outputs.commit_message }} - name: Create Tag id: create_tag if: steps.check_arrow.outputs.contains_arrow == 'true' @@ -98,7 +108,7 @@ jobs: - name: Create Pull Request id: create_pull_request if: steps.check_arrow.outputs.contains_arrow == 'true' && github.ref != 'refs/heads/main' - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | From 6158a6db55f592f67218794bf2b40f296b424c30 Mon Sep 17 00:00:00 2001 From: Cloud Agent Date: Tue, 3 Mar 2026 02:01:18 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=94=96=20Bump=20version:=201.1.15=20?= =?UTF-8?q?=E2=86=92=201.1.16?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 25ad46d..cc79292 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.1.15 +current_version = 1.1.16 commit = True tag = False diff --git a/pyproject.toml b/pyproject.toml index eb56c8a..9e7e044 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "scripts" -version = "1.1.15" +version = "1.1.16" description = "CICD Core Scripts" authors = ["B "] license = "GLPv3"