diff --git a/.github/workflows/auto-bump-version.yml b/.github/workflows/auto-bump-version.yml new file mode 100644 index 0000000..ec272d2 --- /dev/null +++ b/.github/workflows/auto-bump-version.yml @@ -0,0 +1,76 @@ +name: Auto-bump Version on Merge + +on: + push: + branches: + - master + +jobs: + bump-version: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: Calculate and Update Version + id: calc + run: | + # Default to not skipping + echo "SKIP_BUMP=false" >> "$GITHUB_ENV" + + # 1. Extract version from current commit + RAW_VERSION=$(grep -i "^Version:" DESCRIPTION | awk '{print $2}' | tr -d '\r') + + # 2. STRICT FORMAT CHECK: Must be exactly x.y.z (numbers only) + if [[ ! "$RAW_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "❌ ERROR: Version '$RAW_VERSION' is not in strictly x.y.z format." + echo "Failing workflow to prevent malformed versioning." + exit 1 + fi + + # 3. Get version from previous commit safely + OLD_ON_BRANCH=$(git show HEAD^:DESCRIPTION 2>/dev/null | grep -i "^Version:" | awk '{print $2}' | tr -d '\r' || true) + + # 4. Do nothing if manual change is detected + if [ "$RAW_VERSION" != "$OLD_ON_BRANCH" ] && [ -n "$OLD_ON_BRANCH" ]; then + echo "Manual version bump detected ($OLD_ON_BRANCH -> $RAW_VERSION). Doing nothing." + echo "SKIP_BUMP=true" >> "$GITHUB_ENV" + exit 0 + fi + + # 5. z+1 + IFS='.' read -r -a PARTS <<< "$RAW_VERSION" + X=${PARTS[0]} + Y=${PARTS[1]} + Z=${PARTS[2]} + + Z=$((Z + 1)) + NEW_VERSION="$X.$Y.$Z" + + echo "Bumping version from $RAW_VERSION to $NEW_VERSION" + + # 6. Write to file (safely overwrites whatever comes after "Version: ") + sed -i "s/^Version:.*/Version: $NEW_VERSION/i" DESCRIPTION + + # Export for next step + echo "NEW_VERSION=$NEW_VERSION" >> "$GITHUB_ENV" + + - name: Commit and Push + if: env.SKIP_BUMP == 'false' + run: | + git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + + git add DESCRIPTION + + if ! git diff-index --quiet HEAD; then + git commit -m "chore: auto-bump version to ${{ env.NEW_VERSION }} [skip ci]" + git push + echo "✅ Successfully bumped version to ${{ env.NEW_VERSION }}." + else + echo "No changes needed." + fi diff --git a/.github/workflows/remind-news.yml b/.github/workflows/remind-news.yml new file mode 100644 index 0000000..7a803b7 --- /dev/null +++ b/.github/workflows/remind-news.yml @@ -0,0 +1,41 @@ +name: Remind NEWS.md Update + +# We only run this when the PR is first opened so the bot doesn't +# spam the contributor with comments on every single new commit. +on: + pull_request: + types: [opened] + +jobs: + remind-news: + runs-on: ubuntu-latest + permissions: + pull-requests: write # Required so the bot can leave a comment + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Check if NEWS.md was modified + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Get the list of changed files + CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }} HEAD) + + # Check if NEWS.md is in that list + if echo "$CHANGED_FILES" | grep -q "^NEWS\.md$"; then + echo "✅ NEWS.md was updated. No reminder needed." + exit 0 + else + echo "⚠️ NEWS.md not updated. Posting a friendly reminder..." + + # Use the GitHub CLI to post a comment directly to the PR + gh pr comment ${{ github.event.pull_request.number }} --body "👋 **Friendly reminder:** It looks like \`NEWS.md\` wasn't updated in this Pull Request. + + If your changes include bug fixes, new features, or UI tweaks, please consider adding a quick note to the \`# jaspYourModule (development version)\` section so our users know about your awesome work! *(If this is just a minor typo fix, feel free to ignore this message.)*" + + # We exit with 0 (success) so the check turns green and does NOT block the PR + exit 0 + fi diff --git a/DESCRIPTION b/DESCRIPTION index 2f52392..02ecb80 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: jaspModuleTemplate -Type: Package +Type: Package Title: A module for JASP -Version: 0.1.0 +Version: 0.1.1 Date: 2020-10-15 Author: JASP Team Website: jasp-stats.org diff --git a/NEWS.md b/NEWS.md new file mode 100644 index 0000000..b815b9e --- /dev/null +++ b/NEWS.md @@ -0,0 +1,35 @@ +# jaspModuleTemplate Changelog + +> **HOW TO READ AND UPDATE THIS CHANGELOG:** +> +> This document follows a modified [Keep a Changelog](https://keepachangelog.com/) format adapted for the R/JASP ecosystem. Releases are listed in reverse chronological order (newest first). +> As an example see [jaspModuleTemplate](https://github.com/RensDofferhoff/jaspModuleTemplate/blob/master/NEWS.md) +> * **Adding New Changes (For Contributors):** All new commits should be logged at the very top of the file under the `# jaspModuleTemplate (development version)` header. Place your bullet point under the appropriate category (`## Added`, `## Fixed`, etc.). +> * **Issue References:** Please reference the relevant GitHub Issue (if any) at the end of your line (e.g., `([Issue #19](https://github.com/jasp-stats/jaspModuleTemplate/issues/19)`). +> * **Format Categories:** > * **Added:** New template features, QML examples, or build tools. +> * **Changed:** Updates to default configurations, boilerplate code, or dependencies. +> * **Fixed:** Bug fixes in the build pipeline, R wrappers, or QML layouts. +> * **Deprecated / Removed:** Outdated template components or legacy code. + +--- + +# jaspModuleTemplate (development version) + +## Added +* Added NEWS.md +* Added workflow to remind users to update their `NEWS.md`. +* Added workflow to auto-bump version when user does not do so. + +--- + +# jaspModuleTemplate 0.1.0 + +## Added +* Initial examples to showcase JASP module development + +## Changed +* Use best practices for checking input ([Issue #19](https://github.com/jasp-stats/jaspModuleTemplate/issues/19)). +* The main results table now defaults to displaying 95% Confidence Intervals for effect sizes. + +## Fixed +* Remove deprecated dependencies from qml files ([Issue #14](https://github.com/jasp-stats/jaspModuleTemplate/issues/14)).