diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f1e3bf7..d713d83 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,70 +1,117 @@ name: Release on: - push: - branches: - - main schedule: - cron: "0 17 * * 2" # Weekly on Tuesday evenings workflow_dispatch: + inputs: + dry-run: + description: Compute the next versions and release notes without publishing + type: boolean + default: false -jobs: - release-please: - name: Run Release Please - - runs-on: ubuntu-latest - - permissions: - contents: write - pull-requests: write +permissions: + contents: read - outputs: - releases_created: ${{ steps.release.outputs.releases_created }} - paths_released: ${{ steps.release.outputs.paths_released }} +concurrency: + group: release - steps: - - name: Run release-please command - id: release - uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0 - - build-and-publish: - name: Build & Publish +jobs: + release: + name: Release ${{ matrix.package.name }} runs-on: ubuntu-latest - needs: [release-please] - - if: needs.release-please.outputs.paths_released != '[]' + permissions: + contents: write # create the tag and GitHub release + id-token: write # npm trusted publishing strategy: + fail-fast: false matrix: - path: ${{ fromJSON(needs.release-please.outputs.paths_released) }} - - permissions: - contents: read - id-token: write + package: + - name: reveal.js-caffeine + path: plugins/caffeine + - name: reveal.js-joycontroller + path: plugins/joycontroller + - name: reveal.js-qrcodes + path: plugins/qrcodes steps: - name: Checkout repository uses: actions/checkout@v7 + with: + fetch-depth: 0 - - name: Setup pnpm + # Quoted so the shell running the action does not expand the glob + - name: Generate release notes + id: notes + uses: orhun/git-cliff-action@a9a95522b26fe6403f7bb24031f21fb573d0f5ff # v4.9.1 + with: + args: --include-path '${{ matrix.package.path }}/**' --tag-pattern '^${{ matrix.package.name }}-v[0-9]+\.[0-9]+\.[0-9]+$' --unreleased --bump --strip all --output ${{ runner.temp }}/RELEASE_NOTES.md + + # git-cliff reports the latest tag as the next version when nothing is releasable + - name: Check for releasable changes + id: check + env: + NOTES: ${{ runner.temp }}/RELEASE_NOTES.md + VERSION: ${{ steps.notes.outputs.version }} + run: | + if ! grep -q '[^[:space:]]' "$NOTES" || git rev-parse -q --verify "refs/tags/$VERSION" >/dev/null; then + echo "No releasable changes since the last release" + echo "release=false" >> "$GITHUB_OUTPUT" + else + { echo "## $VERSION"; echo; cat "$NOTES"; } >> "$GITHUB_STEP_SUMMARY" + echo "release=true" >> "$GITHUB_OUTPUT" + fi + + - name: Setup pnpm & Node.js + if: steps.check.outputs.release == 'true' uses: pnpm/setup@fbda4c85fc2e1e08721cd8763afea8f48d60f024 # v3.0.0 with: + runtime: node@latest install: false - - name: Setup NodeJS - uses: actions/setup-node@v7 - with: - node-version: latest - registry-url: "https://registry.npmjs.org" - - name: Install dependencies + if: steps.check.outputs.release == 'true' run: pnpm i --frozen-lockfile - - name: Build packages - run: pnpm -r build - - - name: Publish package at ${{ matrix.path }} - run: npm publish - working-directory: ${{ matrix.path }} + - name: Build package + if: steps.check.outputs.release == 'true' + run: pnpm --filter "./${{ matrix.package.path }}" build + + - name: Set package version + if: steps.check.outputs.release == 'true' + working-directory: ${{ matrix.package.path }} + env: + VERSION: ${{ steps.notes.outputs.version }} + run: pnpm version "${VERSION##*-v}" --no-git-tag-version --allow-same-version + + # pnpm publishes via npm trusted publishing (OIDC) itself; the runner's npm is too old for it + # Skipping an already published version lets a failed run be retried safely + # Waiting for the version to be installable keeps the GitHub release from getting ahead of npm + - name: Publish package + if: steps.check.outputs.release == 'true' + working-directory: ${{ matrix.package.path }} + env: + DRY_RUN: ${{ inputs.dry-run }} + VERSION: ${{ steps.notes.outputs.version }} + run: | + name="$(jq -r .name package.json)" + if [[ "$DRY_RUN" == "true" ]]; then + pnpm publish --no-git-checks --dry-run + elif [[ -n "$(pnpm view "$name@${VERSION##*-v}" version 2>/dev/null)" ]]; then + echo "$name@${VERSION##*-v} is already published" + else + pnpm publish --no-git-checks --publish-wait-timeout 600000 + fi + + - name: Create GitHub release + if: steps.check.outputs.release == 'true' && !inputs.dry-run + env: + GH_TOKEN: ${{ github.token }} + NAME: ${{ matrix.package.name }} + NOTES: ${{ runner.temp }}/RELEASE_NOTES.md + VERSION: ${{ steps.notes.outputs.version }} + run: | + gh release create "$VERSION" --target "$GITHUB_SHA" --title "$NAME: v${VERSION##*-v}" --notes-file "$NOTES" diff --git a/.release-please-manifest.json b/.release-please-manifest.json deleted file mode 100644 index 64ad3c0..0000000 --- a/.release-please-manifest.json +++ /dev/null @@ -1 +0,0 @@ -{"plugins/caffeine":"1.1.0","plugins/joycontroller":"1.0.0","plugins/qrcodes":"1.1.0"} \ No newline at end of file diff --git a/README.md b/README.md index 3017d3c..711fdbb 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,10 @@ This repository contains a collection of custom plugins for [Reveal.js](https:// | [🎮 JoyController](plugins/joycontroller) | Custom plugin to control presentations using Nintendo Switch Joy-Cons. | | [🔳 QR Codes](plugins/qrcodes) | Custom plugin to show QR Codes by adding a single class to HTML elements. | +## Changelog + +Release notes for every plugin version are published on the [GitHub Releases](https://github.com/forwardsoftware/revealjs-plugins/releases) page. + --- Made with ✨ & ❤️ by [ForWarD Software](https://github.com/forwardsoftware) and [contributors](https://github.com/forwardsoftware/revealjs-plugins/graphs/contributors) diff --git a/cliff.toml b/cliff.toml new file mode 100644 index 0000000..ebe3b76 --- /dev/null +++ b/cliff.toml @@ -0,0 +1,34 @@ +# git-cliff configuration, see https://git-cliff.org/docs/configuration +# The release workflow runs it once per plugin with --include-path and --tag-pattern + +[changelog] +body = """ +{% for group, commits in commits | group_by(attribute="group") %} +### {{ group | striptags | trim }} +{% for commit in commits %} +- {% if commit.scope %}**{{ commit.scope }}:** {% endif %}{% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }} ({{ commit.id | truncate(length=7, end="") }})\ +{% endfor %} +{% endfor %} +""" +trim = true + +[git] +conventional_commits = true +filter_unconventional = true +filter_commits = true +protect_breaking_commits = true +sort_commits = "newest" +# Group names are prefixed with an HTML comment to control their order +commit_parsers = [ + { message = "^feat", group = "Features" }, + { message = "^fix", group = "Bug Fixes" }, + { message = "^perf", group = "Performance" }, + { message = "^refactor", group = "Refactoring" }, + { message = "^docs", group = "Documentation" }, + { message = "^chore", group = "Miscellaneous" }, + { message = "^(ci|build|test|style)", skip = true }, +] + +[bump] +features_always_bump_minor = true +breaking_always_bump_major = true diff --git a/plugins/caffeine/CHANGELOG.md b/plugins/caffeine/CHANGELOG.md index 63ff3b6..26f93c7 100644 --- a/plugins/caffeine/CHANGELOG.md +++ b/plugins/caffeine/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +> This file is no longer updated. Release notes for newer versions are published on the [GitHub Releases](https://github.com/forwardsoftware/revealjs-plugins/releases?q=reveal.js-caffeine&expanded=true) page. + ## [1.1.0](https://github.com/forwardsoftware/revealjs-plugins/compare/reveal.js-caffeine-v1.0.0...reveal.js-caffeine-v1.1.0) (2025-02-05) diff --git a/plugins/caffeine/README.md b/plugins/caffeine/README.md index b37715d..e2d94a4 100644 --- a/plugins/caffeine/README.md +++ b/plugins/caffeine/README.md @@ -31,6 +31,10 @@ caffeine: { } ``` +## Changelog + +Release notes for every version are published on the [GitHub Releases](https://github.com/forwardsoftware/revealjs-plugins/releases?q=reveal.js-caffeine&expanded=true) page. + ## License MIT diff --git a/plugins/joycontroller/CHANGELOG.md b/plugins/joycontroller/CHANGELOG.md index 83df5f5..336d63f 100644 --- a/plugins/joycontroller/CHANGELOG.md +++ b/plugins/joycontroller/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +> This file is no longer updated. Release notes for newer versions are published on the [GitHub Releases](https://github.com/forwardsoftware/revealjs-plugins/releases?q=reveal.js-joycontroller&expanded=true) page. + ## 1.0.0 (2025-02-06) diff --git a/plugins/joycontroller/README.md b/plugins/joycontroller/README.md index 97ff7bb..0f332de 100644 --- a/plugins/joycontroller/README.md +++ b/plugins/joycontroller/README.md @@ -34,6 +34,10 @@ joycon: { Inspired by [Firnael/reveal.js-joycon-plugin](https://github.com/Firnael/reveal.js-joycon-plugin) +## Changelog + +Release notes for every version are published on the [GitHub Releases](https://github.com/forwardsoftware/revealjs-plugins/releases?q=reveal.js-joycontroller&expanded=true) page. + ## License MIT diff --git a/plugins/qrcodes/CHANGELOG.md b/plugins/qrcodes/CHANGELOG.md index 975dcd0..588156d 100644 --- a/plugins/qrcodes/CHANGELOG.md +++ b/plugins/qrcodes/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +> This file is no longer updated. Release notes for newer versions are published on the [GitHub Releases](https://github.com/forwardsoftware/revealjs-plugins/releases?q=reveal.js-qrcodes&expanded=true) page. + ## [1.1.0](https://github.com/forwardsoftware/revealjs-plugins/compare/reveal.js-qrcodes-v1.0.0...reveal.js-qrcodes-v1.1.0) (2025-04-01) diff --git a/plugins/qrcodes/README.md b/plugins/qrcodes/README.md index 974ffdd..baf7e00 100644 --- a/plugins/qrcodes/README.md +++ b/plugins/qrcodes/README.md @@ -131,6 +131,9 @@ Since [Reveal.js](https://revealjs.com/) will add constraints to `max-width` and > [!NOTE] > Change `.qrcode` selector with the class you chose as `selector` in [Global Configuration](#global-configuration) +## Changelog + +Release notes for every version are published on the [GitHub Releases](https://github.com/forwardsoftware/revealjs-plugins/releases?q=reveal.js-qrcodes&expanded=true) page. ## License diff --git a/release-please-config.json b/release-please-config.json deleted file mode 100644 index 5554aec..0000000 --- a/release-please-config.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", - "release-type": "node", - "separate-pull-requests": true, - "always-update": true, - "packages": { - "plugins/caffeine": {}, - "plugins/joycontroller": {}, - "plugins/qrcodes": {} - } -} \ No newline at end of file