From c86f6d9333e578d59f99bab960e0a22bd639260d Mon Sep 17 00:00:00 2001 From: Chinmay-KB Date: Sun, 22 Mar 2026 04:36:14 +0530 Subject: [PATCH] chore: add .pubignore and GitHub workflows for PR checks and publishing - Introduced .pubignore to exclude unnecessary files from publication - Added PR checks workflow to validate version bumps and changelog updates - Created publish workflow for automated publishing to pub.dev --- .github/workflows/dart.yml | 4 +- .github/workflows/pr-checks.yml | 69 +++++++++++++++++++++++++++++++++ .github/workflows/publish.yml | 13 +++++++ .pubignore | 11 ++++++ CHANGELOG.md | 10 ++++- 5 files changed, 103 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/pr-checks.yml create mode 100644 .github/workflows/publish.yml create mode 100644 .pubignore diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 0b16d1c..7027212 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -3,8 +3,6 @@ name: Dart on: push: branches: [ master ] - pull_request: - branches: [ master ] jobs: build: @@ -13,7 +11,7 @@ jobs: image: dart:stable steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Print Dart SDK version run: dart --version diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml new file mode 100644 index 0000000..4d1fcdb --- /dev/null +++ b/.github/workflows/pr-checks.yml @@ -0,0 +1,69 @@ +name: PR checks + +on: + pull_request: + branches: [ master ] + +jobs: + check: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Dart + uses: dart-lang/setup-dart@v1 + with: + sdk: stable + cache: pub + + - name: Fetch base ref + run: git fetch origin ${{ github.base_ref }} + + - name: Check version bumped + run: | + BASE_VERSION=$(git show origin/${{ github.base_ref }}:pubspec.yaml 2>/dev/null | sed -n 's/^version: *//p' | tr -d ' \r' || echo "0.0.0") + CURRENT_VERSION=$(sed -n 's/^version: *//p' pubspec.yaml | tr -d ' \r') + + if [ -z "$CURRENT_VERSION" ]; then + echo "::error::Could not read version from pubspec.yaml" + exit 1 + fi + + if [ "$(printf '%s\n%s' "$BASE_VERSION" "$CURRENT_VERSION" | sort -V | head -1)" = "$CURRENT_VERSION" ] && [ "$BASE_VERSION" != "$CURRENT_VERSION" ]; then + echo "::error::Version $CURRENT_VERSION is not greater than base version $BASE_VERSION. Bump the version in pubspec.yaml." + exit 1 + fi + + if [ "$BASE_VERSION" = "$CURRENT_VERSION" ]; then + echo "::error::Version was not bumped. Base is $BASE_VERSION, current is $CURRENT_VERSION. Bump the version in pubspec.yaml." + exit 1 + fi + + echo "Version bumped: $BASE_VERSION -> $CURRENT_VERSION" + + - name: Check changelog updated + run: | + CURRENT_VERSION=$(sed -n 's/^version: *//p' pubspec.yaml | tr -d ' \r') + + if ! grep -qF "## [$CURRENT_VERSION]" CHANGELOG.md; then + echo "::error::CHANGELOG.md has no entry for version $CURRENT_VERSION. Add a section '## [$CURRENT_VERSION]' with your changes." + exit 1 + fi + + echo "CHANGELOG has entry for $CURRENT_VERSION" + + - name: Install dependencies + run: dart pub get + + - name: Static analysis + run: dart analyze + + - name: Run tests + run: dart test + + - name: Publish dry-run + run: dart pub publish --dry-run diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..036b5bf --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,13 @@ +# https://dart.dev/tools/pub/automated-publishing +name: Publish to pub.dev + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + +jobs: + publish: + permissions: + id-token: write + uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1 diff --git a/.pubignore b/.pubignore new file mode 100644 index 0000000..5c6bc21 --- /dev/null +++ b/.pubignore @@ -0,0 +1,11 @@ +.github/ +AGENTS.md +CLAUDE.md +CODE_OF_CONDUCT.md +CONTRIBUTING.md +SECURITY.md +SUPPORT.md +codecov.yml +codemagic.yaml +coverage/ +coverage_badge.svg diff --git a/CHANGELOG.md b/CHANGELOG.md index 64935cf..026188b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## [1.2.2] - 2026 + +### Bug Fixes +* Fixed `capitalize()` to normalize already-capitalized and all-uppercase inputs like `HELLO` and `HeLLo` to `Hello` +* Preserved acronym tokens in `camelCase()` while fixing `capitalize()` behavior + +### Tests +* Added regression coverage for uppercase and mixed-case `capitalize()` inputs + ## [1.2.1] - 2025 ### Documentation @@ -60,4 +69,3 @@ ## [0.0.2-prerelease] - 04/01/2021 * Trying to get full pub score -