feat: 完善项目文档和推广策略 - 添加许可证、贡献指南、TODO计划、部署配置等 #1
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: 部署到 GitHub Pages | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| pull_request: | |
| branches: [ main, master ] | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 检出代码 | |
| uses: actions/checkout@v3 | |
| - name: 设置 Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18' | |
| - name: 安装依赖 | |
| run: | | |
| npm install -g html-minifier-terser | |
| npm install -g clean-css-cli | |
| npm install -g terser | |
| - name: 优化资源 | |
| run: | | |
| # 压缩CSS | |
| cleancss -o styles.min.css styles.css | |
| # 压缩JavaScript | |
| terser script.js -o script.min.js -c -m | |
| # 压缩HTML | |
| html-minifier-terser --collapse-whitespace --remove-comments --remove-optional-tags --remove-redundant-attributes --remove-script-type-attributes --remove-tag-whitespace --use-short-doctype --minify-css true --minify-js true -o index.min.html index.html | |
| - name: 部署到 GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v3 | |
| if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./ |