Skip to content

Merge branch 'main' of https://github.com/jwyGithub/eslint-config #46

Merge branch 'main' of https://github.com/jwyGithub/eslint-config

Merge branch 'main' of https://github.com/jwyGithub/eslint-config #46

Workflow file for this run

# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
name: build and publish
on:
push:
branches:
- main
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 'latest'
registry-url: 'https://registry.npmjs.org'
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: latest
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Lint
run: pnpm lint
- name: Prettier
run: pnpm prettier --check .
- name: Build
run: pnpm run build
- name: Configure git
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
- name: Get version bump
id: bump
run: |
LAST_COMMIT_MSG=$(git log -1 --pretty=%B)
if [[ $LAST_COMMIT_MSG == fix:* ]]; then
echo "type=patch" >> $GITHUB_OUTPUT
elif [[ $LAST_COMMIT_MSG == feat:* ]]; then
echo "type=minor" >> $GITHUB_OUTPUT
elif [[ $LAST_COMMIT_MSG == chore:* ]]; then
echo "type=major" >> $GITHUB_OUTPUT
else
echo "type=patch" >> $GITHUB_OUTPUT
fi
- name: Bump version
run: pnpm standard-version --release-as ${{ steps.bump.outputs.type }}
- name: Push changes
run: |
git push --follow-tags origin main
- name: Publish to npm
run: pnpm publish --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH }}