diff --git a/.github/conventional-changelog.config.js b/.github/conventional-changelog.config.js new file mode 100644 index 0000000..8d34248 --- /dev/null +++ b/.github/conventional-changelog.config.js @@ -0,0 +1,14 @@ +module.exports = { + types: [ + { type: 'feat', section: 'Features' }, + { type: 'fix', section: 'Bug Fixes' }, + { type: 'chore', section: 'Maintenance' }, + { type: 'docs', section: 'Documentation' }, + { type: 'style', section: 'Styling' }, + { type: 'refactor', section: 'Code Refactoring' }, + { type: 'perf', section: 'Performance' }, + { type: 'test', section: 'Testing' }, + { type: 'ci', section: 'CI/CD' }, + { type: 'build', section: 'Build System' } + ] +}; diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5b22a91..f3514da 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,75 +1,60 @@ -name: Publish Package - -on: - push: - branches: [ main ] - workflow_dispatch: - -permissions: - contents: write - pull-requests: write - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '18.x' - registry-url: 'https://registry.npmjs.org' - - - name: Install dependencies - run: npm ci - - - name: Conventional Changelog Action - id: changelog - uses: TriPSs/conventional-changelog-action@v6 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - git-message: 'chore(release): {version}' - preset: | - { - "name": "custom", - "types": [ - {"type": "feat", "section": "Features"}, - {"type": "fix", "section": "Bug Fixes"}, - {"type": "chore", "section": "Maintenance"}, - {"type": "docs", "section": "Documentation"}, - {"type": "style", "section": "Styling"}, - {"type": "refactor", "section": "Code Refactoring"}, - {"type": "perf", "section": "Performance"}, - {"type": "test", "section": "Testing"}, - {"type": "ci", "section": "CI/CD"}, - {"type": "build", "section": "Build System"} - ] - } - tag-prefix: 'v' - output-file: 'CHANGELOG.md' - skip-version-file: false - skip-commit: false - skip-on-empty: false - git-user-name: ${{ secrets.CHANGELOG_GIT_NAME }} - git-user-email: ${{ secrets.CHANGELOG_GIT_EMAIL }} - - - name: Build - run: npm run build - - - name: Create Release - if: steps.changelog.outputs.skipped == 'false' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh release create v${{ steps.changelog.outputs.version }} \ - --title "Release v${{ steps.changelog.outputs.version }}" \ - --notes "${{ steps.changelog.outputs.clean_changelog }}" - - - name: Publish to NPM - if: steps.changelog.outputs.skipped == 'false' - run: npm publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} +name: Publish Package + +on: + push: + branches: [ main ] + workflow_dispatch: + +permissions: + contents: write + pull-requests: write + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18.x' + registry-url: 'https://registry.npmjs.org' + + - name: Install dependencies + run: npm ci + + - name: Conventional Changelog Action + id: changelog + uses: TriPSs/conventional-changelog-action@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + git-message: 'chore(release): {version}' + config-file-path: '.github/conventional-changelog.config.js' + tag-prefix: 'v' + output-file: 'CHANGELOG.md' + skip-version-file: false + skip-commit: false + skip-on-empty: false + git-user-name: ${{ secrets.CHANGELOG_GIT_NAME }} + git-user-email: ${{ secrets.CHANGELOG_GIT_EMAIL }} + + - name: Build + run: npm run build + + - name: Create Release + if: steps.changelog.outputs.skipped == 'false' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release create v${{ steps.changelog.outputs.version }} \ + --title "Release v${{ steps.changelog.outputs.version }}" \ + --notes "${{ steps.changelog.outputs.clean_changelog }}" + + - name: Publish to NPM + if: steps.changelog.outputs.skipped == 'false' + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}