Skip to content

ci: add git user config for changelog generation #2

ci: add git user config for changelog generation

ci: add git user config for changelog generation #2

Workflow file for this run

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: 'conventionalcommits'
tag-prefix: 'v'
output-file: 'CHANGELOG.md'
skip-version-file: false
skip-commit: 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: Push changes
if: steps.changelog.outputs.skipped == 'false'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add package.json CHANGELOG.md
git commit -m "chore(release): v${{ steps.changelog.outputs.version }}"
git push "https://[email protected]/$GITHUB_REPOSITORY.git" HEAD:main