chore: release and pre-commit #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
workflow_dispatch: | |
push: | |
pull_request: | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
ref: ${{ github.head_ref }} | |
- name: Set up python | |
uses: actions/setup-python@v3 | |
- name: Run pre-commit on codebase | |
uses: pre-commit/action@v3.0.0 | |
- name: Auto commit action | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
if: failure() | |
with: | |
commit_message: 'ci: auto fixes from pre-commit' | |
release: | |
name: release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: Semantic Release | |
uses: cycjimmy/semantic-release-action@v4 | |
id: semantic | |
with: | |
semantic_version: 22.0.5 | |
branches: | | |
[ | |
'+([0-9])?(.{+([0-9]),x}).x', | |
'master', | |
'main', | |
'next', | |
'next-major', | |
{ | |
name: 'beta', | |
prerelease: true | |
}, | |
{ | |
name: 'alpha', | |
prerelease: true | |
} | |
] | |
extra_plugins: | | |
@semantic-release/changelog | |
@semantic-release/git | |
@semantic-release/exec | |
@semantic-release/github | |
conventional-changelog-conventionalcommits | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish To GitHub Package Registry | |
if: steps.semantic.outputs.new_release_published == 'true' | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
- name: Push updates to branch for major version | |
if: steps.semantic.outputs.new_release_published == 'true' | |
run: git push https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git HEAD:refs/heads/v${{steps.semantic.outputs.new_release_major_version}} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |