Skip to content

feat(icons): replace antd-icons to hankliu-icons and hankliu-colors #6

feat(icons): replace antd-icons to hankliu-icons and hankliu-colors

feat(icons): replace antd-icons to hankliu-icons and hankliu-colors #6

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: Publish HankLiu-Design Components Into NPM
on:
push:
branches:
# 触发ci/cd的代码分支
- master
pull_request:
branches: [ master ]
jobs:
setup:
# 指定操作系统
runs-on: ubuntu-latest
steps:
# 将代码拉到虚拟机
- name: 获取源码 🛎️
uses: actions/checkout@v2
# 指定node版本
- name: Node环境版本 🗜️
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
- name: 获取lock文件 🎻
uses: actions/cache@v2
with:
path: package-temp-dir
key: lock-${{ github.sha }}
# 仅在不下载任何包的情况下,更新package-lock.json文件。
# 这个命令常用于确保所有的依赖项都是最新的,或者在你不确定更新了哪些包时刷新锁文件。
- name: 更新lock文件 📌
run: npm i --package-lock-only --force
# 缓存lock文件到package-temp-dir路径
- name: 缓存lock文件 🗼
run: |
if [ ! -d "package-temp-dir" ]; then
mkdir package-temp-dir
fi
cp package-lock.json package-temp-dir
# 依赖缓存策略
- name: Npm缓存 📁
id: node_modules_cache_id
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
# 依赖下载
- name: 安装依赖 📦
if: steps.node_modules_cache_id.outputs.cache-hit != 'true'
run: npm ci --force
compile:
runs-on: ubuntu-latest
steps:
# 将代码拉到虚拟机
- name: 获取源码 🛎️
uses: actions/checkout@v2
# 指定node版本
- name: Node环境版本 🗜️
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
# 获取或存的lock文件
- name: 获取lock文件 🎻
uses: actions/cache@v2
with:
path: package-temp-dir
key: lock-${{ github.sha }}
# 依赖缓存策略
- name: Npm缓存 📁
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
# 打包
- name: 打包 🏗️
run: npm run compile
# 发布
- name: 发布 🚀
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
needs: setup
site:
runs-on: ubuntu-latest
steps:
# 将代码拉到虚拟机
- name: 获取源码 🛎️
uses: actions/checkout@v2
# 获取或存的lock文件
- name: 获取lock文件 🎻
uses: actions/cache@v2
with:
path: package-temp-dir
key: lock-${{ github.sha }}
# 依赖缓存策略
- name: Npm缓存 📁
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
# 生成文档
- name: 生成文档 🍚
run: npm run site && touch ./_site/.nojekyll # run: touch ./_website/.nojekyll是因为由于 Jekyll 处理,GitHub 默认不提供_next文件夹,.nojekyll文件阻止了这种情况,
- name: 部署 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages # 部署后提交到那个分支
folder: _site # 这里填打包好的目录名称
clean: true
needs: compile
tag:
runs-on: ubuntu-latest
steps:
# 将代码拉到虚拟机
- name: 获取源码 🛎️
uses: actions/checkout@v2
- name: 从 package.json 中获得版本 ⭐
id: version
run: echo "VERSION=$(node -p 'require(`./package.json`).version')" >> $GITHUB_ENV
- name: 提交 Tag 🏄
id: tag
run: |
git config --local user.email "${{ secrets.MY_GIT_USER_EMAIL }}"
git config --local user.name "${{ secrets.MY_GIT_USER_NAME }}"
git tag -a v${{ env.VERSION }} -m "create tag v${{ env.VERSION }}"
git push origin v${{ env.VERSION }}
needs: site