diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4702441..60f71bf 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,16 +1,17 @@ -name: Luacheck +name: Lint on: - pull_request: - push: - branches: [master] + pull_request_target: + branches: + - master jobs: luacheck: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Run luacheck - uses: lunarmodules/luacheck@v1.2.0 + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + - uses: nebularg/actions-luacheck@v1 + with: + args: --no-color diff --git a/.github/workflows/release-pr.yml b/.github/workflows/release-pr.yml new file mode 100644 index 0000000..9c4468d --- /dev/null +++ b/.github/workflows/release-pr.yml @@ -0,0 +1,50 @@ +name: Release PR + +on: + push: + branches: + - master + paths-ignore: + - CHANGELOG.md + +permissions: + contents: write + pull-requests: write + +jobs: + release-pr: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v5 + with: + fetch-depth: 0 + + - name: Generate changelog + id: git-cliff + uses: orhun/git-cliff-action@v4 + with: + config: cliff.toml + args: --bump --verbose + env: + OUTPUT: CHANGELOG.md + GITHUB_REPO: ${{ github.repository }} + + - name: Normalize version + id: version + if: steps.git-cliff.outputs.version + run: | + VERSION="${{ steps.git-cliff.outputs.version }}" + VERSION="${VERSION#v}" + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + + - name: Create/update release PR + if: steps.version.outputs.version + uses: peter-evans/create-pull-request@v7 + with: + branch: release/next + title: "chore: release ${{ steps.version.outputs.version }}" + labels: autorelease + commit-message: "chore: release ${{ steps.version.outputs.version }}" + body: "Automated release PR for version ${{ steps.version.outputs.version }}" + delete-branch: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 07a0d74..d806e41 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,45 +2,148 @@ name: Release on: push: + tags: + - "*" + pull_request: + types: [closed] branches: - master workflow_dispatch: inputs: tag_name: - description: 'Tag to package (e.g. 1.1.2)' + description: "Tag to package (e.g. 1.1.2)" required: true type: string permissions: contents: write - pull-requests: write + pull-requests: read jobs: - release-please: - if: ${{ github.event_name != 'workflow_dispatch' }} + create-tag: + name: Create tag from release PR + if: >- + github.event_name == 'pull_request' && + github.event.pull_request.merged == true && + contains(github.event.pull_request.labels.*.name, 'autorelease') runs-on: ubuntu-latest outputs: - release_created: ${{ steps.release.outputs.release_created }} - tag_name: ${{ steps.release.outputs.tag_name }} + tag: ${{ steps.tag.outputs.tag }} steps: - - uses: googleapis/release-please-action@v4 - id: release + - name: Checkout + uses: actions/checkout@v5 + with: + fetch-depth: 0 + + - name: Extract version and create tag + id: tag + shell: bash + run: | + TITLE="${{ github.event.pull_request.title }}" + TAG=$(echo "$TITLE" | grep -oP '\d+\.\d+\.\d+') + if [ -z "$TAG" ]; then + echo "::error::Could not extract version from PR title: $TITLE" + exit 1 + fi + echo "tag=$TAG" >> "$GITHUB_OUTPUT" + 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" + + changelog: + name: Generate changelog + needs: [create-tag] + if: >- + always() && + github.event_name != 'pull_request' && + (github.ref_type == 'tag' || github.event_name == 'workflow_dispatch') + runs-on: ubuntu-latest + outputs: + tag: ${{ steps.vars.outputs.tag }} + steps: + - name: Checkout + uses: actions/checkout@v5 + with: + fetch-depth: 0 + + - name: Resolve tag + id: vars + shell: bash + run: | + TAG="" + if [ "${{ github.ref_type }}" = "tag" ]; then + TAG="${{ github.ref_name }}" + elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + TAG="${{ github.event.inputs.tag_name }}" + fi + echo "tag=$TAG" >> "$GITHUB_OUTPUT" + + - name: Generate changelog + uses: orhun/git-cliff-action@v4 + with: + config: cliff.toml + args: --verbose + env: + OUTPUT: CHANGELOG.md + GITHUB_REPO: ${{ github.repository }} + + - name: Commit changelog to default branch + shell: bash + run: | + BRANCH="${{ github.event.repository.default_branch }}" + git switch "$BRANCH" + git config user.name 'github-actions[bot]' + git config user.email 'github-actions[bot]@users.noreply.github.com' + + git add CHANGELOG.md + if git diff --cached --quiet; then + exit 0 + fi + + git commit -m "Update changelog" + git push origin "HEAD:$BRANCH" package: - needs: release-please - if: ${{ always() && (needs.release-please.outputs.release_created == 'true' || github.event_name == 'workflow_dispatch') }} + name: Package + needs: [create-tag, changelog] + if: >- + always() && ( + needs.create-tag.result == 'success' || + github.ref_type == 'tag' || + github.event_name == 'workflow_dispatch' + ) runs-on: ubuntu-latest env: CF_API_KEY: ${{ secrets.CF_API_KEY }} - WOWI_API_TOKEN: ${{ secrets.WOWI_API_TOKEN }} WAGO_API_TOKEN: ${{ secrets.WAGO_API_TOKEN }} GITHUB_OAUTH: ${{ secrets.GITHUB_TOKEN }} steps: - - name: Clone project - uses: actions/checkout@v4 + - name: Resolve tag + id: resolve + shell: bash + run: | + TAG="" + if [ -n "${{ needs.create-tag.outputs.tag }}" ]; then + TAG="${{ needs.create-tag.outputs.tag }}" + elif [ "${{ github.ref_type }}" = "tag" ]; then + TAG="${{ github.ref_name }}" + elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + TAG="${{ github.event.inputs.tag_name }}" + fi + if [ -z "$TAG" ]; then + echo "::error::No tag could be resolved" + exit 1 + fi + echo "TAG_NAME=$TAG" >> "$GITHUB_ENV" + + - name: Checkout tag + uses: actions/checkout@v5 with: - ref: ${{ needs.release-please.outputs.tag_name || github.event.inputs.tag_name }} + ref: refs/tags/${{ env.TAG_NAME }} fetch-depth: 0 - - name: Package and release + - name: Package and upload uses: BigWigsMods/packager@v2 + env: + GITHUB_REF: refs/tags/${{ env.TAG_NAME }} diff --git a/.release-please-manifest.json b/.release-please-manifest.json deleted file mode 100644 index c4ddc74..0000000 --- a/.release-please-manifest.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - ".": "1.1.1" -} diff --git a/CHANGELOG.md b/CHANGELOG.md index 22d100f..86c3dc5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,30 +1,58 @@ -# Changelog +## [unreleased] -## [1.1.1](https://github.com/Xerrion/RaidLogAuto/compare/1.1.0...1.1.1) (2026-02-21) +### โš™๏ธ Miscellaneous Tasks +- Add workflow_dispatch trigger for manual packaging (#12) +## [1.1.2] - 2026-02-21 -### Bug Fixes +### ๐Ÿ“š Documentation -* restore tag configuration in release-please config ([#9](https://github.com/Xerrion/RaidLogAuto/issues/9)) ([d22cff8](https://github.com/Xerrion/RaidLogAuto/commit/d22cff8648bbb2cb411848bf3321a2eadf93aacc)) +- Update AGENTS.md for combined workflow -## [1.1.0](https://github.com/Xerrion/RaidLogAuto/compare/v1.0.2...1.1.0) (2026-02-21) +### โš™๏ธ Miscellaneous Tasks +- Combine release-please and packager into single workflow +- Combine release-please and packager into single workflow (#11) +## [1.1.1] - 2026-02-21 -### Features +### ๐Ÿ› Bug Fixes -* split addon into version-specific files for multi-version support ([39aaa8c](https://github.com/Xerrion/RaidLogAuto/commit/39aaa8ced0bdc8dce806c555f570534a0d5c39e2)) -* split addon into version-specific files for multi-version support ([601c482](https://github.com/Xerrion/RaidLogAuto/commit/601c48281f3db194bdd24d7aa07c9ab55203e32e)) +- Restore tag configuration in release-please config (#9) +### ๐Ÿ’ผ Other -### Bug Fixes +- Simplify release-please tag configuration (#7) -* remove unused variables in RaidLogAuto_Classic.lua ([b6cc09b](https://github.com/Xerrion/RaidLogAuto/commit/b6cc09b5eeae52b1a786cc1a7709e4032924766e)) -* remove unused variables in RaidLogAuto_Legacy.lua ([814454a](https://github.com/Xerrion/RaidLogAuto/commit/814454a362616fc8b1f303b72d0fe1b5d94b1c57)) -* remove unused variables in RaidLogAuto_Main.lua ([c252942](https://github.com/Xerrion/RaidLogAuto/commit/c252942f34338ce3936c250db3285462d51a802a)) +### โš™๏ธ Miscellaneous Tasks -## 1.0.2 (2026-02-08) +- Update release please info (#6) +- Configure changelog sections for release-please (#8) +- *(master)* Release 1.1.1 (#10) +## [1.1.0] - 2026-02-21 -### Features +### ๐Ÿš€ Features -* Add MoP Classic support -* Exclude icon and generator script from release package +- Split addon into version-specific files for multi-version support + +### ๐Ÿ› Bug Fixes + +- Remove unused variables in RaidLogAuto_Main.lua +- Remove unused variables in RaidLogAuto_Legacy.lua +- Remove unused variables in RaidLogAuto_Classic.lua + +### ๐Ÿšœ Refactor + +- Split addon into version-specific files (#5) + +### ๐Ÿ“š Documentation + +- Modernize README with badges, emojis, and visual improvements + +### โš™๏ธ Miscellaneous Tasks + +- Add Release Please for automated versioning and changelog +- Add luacheck linting workflow +- Add luacheck configuration +- Remove redundant release-type from workflow +- *(master)* Release 1.1.0 (#4) +## [1.0.0] - 2026-02-08 diff --git a/cliff.toml b/cliff.toml new file mode 100644 index 0000000..a18fc20 --- /dev/null +++ b/cliff.toml @@ -0,0 +1,94 @@ +# git-cliff ~ configuration file +# https://git-cliff.org/docs/configuration + + +[changelog] +# A Tera template to be rendered for each release in the changelog. +# See https://keats.github.io/tera/docs/#introduction +body = """ +{% if version %}\ + ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} +{% else %}\ + ## [unreleased] +{% endif %}\ +{% for group, commits in commits | group_by(attribute="group") %} + ### {{ group | striptags | trim | upper_first }} + {% for commit in commits %} + - {% if commit.scope %}*({{ commit.scope }})* {% endif %}\ + {% if commit.breaking %}[**breaking**] {% endif %}\ + {{ commit.message | upper_first }}\ + {% endfor %} +{% endfor %} +""" +# Remove leading and trailing whitespaces from the changelog's body. +trim = true +# Render body even when there are no releases to process. +render_always = true +# An array of regex based postprocessors to modify the changelog. +postprocessors = [ + # Replace the placeholder with a URL. + #{ pattern = '', replace = "https://github.com/orhun/git-cliff" }, +] +# render body even when there are no releases to process +# render_always = true +# output file path +# output = "test.md" + +[git] +# Parse commits according to the conventional commits specification. +# See https://www.conventionalcommits.org +conventional_commits = true +# Exclude commits that do not match the conventional commits specification. +filter_unconventional = true +# Require all commits to be conventional. +# Takes precedence over filter_unconventional. +require_conventional = false +# Split commits on newlines, treating each line as an individual commit. +split_commits = false +# An array of regex based parsers to modify commit messages prior to further processing. +commit_preprocessors = [ + # Replace issue numbers with link templates to be updated in `changelog.postprocessors`. + #{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](/issues/${2}))"}, + # Check spelling of the commit message using https://github.com/crate-ci/typos. + # If the spelling is incorrect, it will be fixed automatically. + #{ pattern = '.*', replace_command = 'typos --write-changes -' }, +] +# Prevent commits that are breaking from being excluded by commit parsers. +protect_breaking_commits = false +# An array of regex based parsers for extracting data from the commit message. +# Assigns commits to groups. +# Optionally sets the commit's scope and can decide to exclude commits from further processing. +commit_parsers = [ + { message = "^feat", group = "๐Ÿš€ Features" }, + { message = "^fix", group = "๐Ÿ› Bug Fixes" }, + { message = "^doc", group = "๐Ÿ“š Documentation" }, + { message = "^perf", group = "โšก Performance" }, + { message = "^refactor", group = "๐Ÿšœ Refactor" }, + { message = "^style", group = "๐ŸŽจ Styling" }, + { message = "^test", group = "๐Ÿงช Testing" }, + { message = "^chore\\(release\\): prepare for", skip = true }, + { message = "^chore\\(deps.*\\)", skip = true }, + { message = "^chore\\(pr\\)", skip = true }, + { message = "^chore\\(pull\\)", skip = true }, + { message = "^chore|^ci", group = "โš™๏ธ Miscellaneous Tasks" }, + { body = ".*security", group = "๐Ÿ›ก๏ธ Security" }, + { message = "^revert", group = "โ—€๏ธ Revert" }, + { message = ".*", group = "๐Ÿ’ผ Other" }, +] +# Exclude commits that are not matched by any commit parser. +filter_commits = false +# Fail on a commit that is not matched by any commit parser. +fail_on_unmatched_commit = false +# An array of link parsers for extracting external references, and turning them into URLs, using regex. +link_parsers = [] +# Include only the tags that belong to the current branch. +use_branch_tags = false +# Order releases topologically instead of chronologically. +topo_order = false +# Order commits topologically instead of chronologically. +topo_order_commits = true +# Order of commits in each group/release within the changelog. +# Allowed values: newest, oldest +sort_commits = "oldest" +# Process submodules commits +recurse_submodules = false diff --git a/release-please-config.json b/release-please-config.json deleted file mode 100644 index 009f6b2..0000000 --- a/release-please-config.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", - "release-type": "simple", - "changelog-sections": [ - { "type": "feat", "section": "Features" }, - { "type": "fix", "section": "Bug Fixes" }, - { "type": "refactor", "section": "Refactors" }, - { "type": "docs", "section": "Documentation" }, - { "type": "ci", "section": "CI", "hidden": true }, - { "type": "build", "section": "Build", "hidden": true }, - { "type": "chore", "section": "Miscellaneous", "hidden": true } - ], - "packages": { - ".": { - "changelog-path": "CHANGELOG.md", - "include-component-in-tag": false, - "include-v-in-tag": false - } - } -}