fix: correct isCommand type and add isRepliable method #19
Workflow file for this run
This file contains hidden or 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: Publish NPM package | |
on: | |
push: | |
tags: | |
- "v*" | |
permissions: | |
contents: write # needed to create releases | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v5 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js | |
uses: actions/setup-node@v5 | |
with: | |
node-version: "20" | |
registry-url: "https://registry.npmjs.org" | |
- name: Install dependencies | |
run: npm install | |
# - name: Test | |
# run: npm test | |
- name: Check the version | |
id: check | |
run: | | |
CURRENT_VERSION=$(jq -r .version package.json) | |
echo "Current version: $CURRENT_VERSION" | |
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") | |
echo "Latest tag: $LATEST_TAG" | |
LATEST_VERSION=${LATEST_TAG#v} | |
if [ "$LATEST_VERSION" = "$CURRENT_VERSION" ]; | |
then | |
echo "Version is equal" | |
echo "version_equal=true" >> $GITHUB_OUTPUT | |
echo "new_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT | |
else | |
echo "Version is not equal" | |
echo "version_equal=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Build | |
run: npm run build | |
if: steps.check.outputs.version_equal == 'true' | |
- name: Publish | |
if: steps.check.outputs.version_equal == 'true' | |
run: npm publish --access public --no-git-checks | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
# - name: Git Info Update | |
# if: steps.check.outputs.version_equal == 'true' | |
# run: | | |
# git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
# git config --local user.name "github-actions[bot]" | |
- name: Install GitHub CLI | |
run: sudo apt-get install gh -y | |
- name: Zip dist folder | |
run: zip -r dist.zip dist | |
- name: Create GitHub release | |
if: steps.check.outputs.version_equal == 'true' | |
run: | | |
gh release create "v${{ steps.check.outputs.new_version }}" \ | |
dist.zip \ | |
--title "v${{ steps.check.outputs.new_version }}" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |