Skip to content

🐞 fix(CusIcon): 打包导出错误 #22

🐞 fix(CusIcon): 打包导出错误

🐞 fix(CusIcon): 打包导出错误 #22

Workflow file for this run

name: Build and Publish
on:
push:
branches: [ main ]
jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'
scope: '@marherb-work'
- name: Check package.json version change
id: check_version
run: |
PACKAGE_NAME=$(node -p "require('./package.json').name")
CURRENT_VERSION=$(node -p "require('./package.json').version")
NPM_VERSION=$(npm view $PACKAGE_NAME version || echo "0.0.0")
if [ "$(printf '%s\n' "$NPM_VERSION" "$CURRENT_VERSION" | sort -V | tail -n1)" != "$NPM_VERSION" ] || [ "$NPM_VERSION" == "0.0.0" ]; then
echo "Current version is greater than npm version, or package has not been published to npm yet."
echo "version_changed=true" >> $GITHUB_ENV
else
echo "Current version is less than or equal to npm version."
echo "version_changed=false" >> $GITHUB_ENV
fi
- name: Install dependencies
if: env.version_changed == 'true'
run: yarn install
- name: Build package
if: env.version_changed == 'true'
run: yarn build
- name: Publish to NPM
if: env.version_changed == 'true'
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
publish-page:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install dependencies
run: yarn install
- name: Build package
run: yarn cosmos-export
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./cosmos-export