|
| 1 | +name: docs |
| 2 | + |
| 3 | +on: |
| 4 | + # 每当 push 到 main 分支时触发部署 |
| 5 | + push: |
| 6 | + branches: [main] |
| 7 | + # 手动触发部署 |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + docs: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v4 |
| 16 | + with: |
| 17 | + # “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录 |
| 18 | + fetch-depth: 0 |
| 19 | + |
| 20 | + - name: Init VuePress |
| 21 | + run: | |
| 22 | + echo '{ |
| 23 | + "name": "spring-cloud-stream-redis-doc", |
| 24 | + "version": "0.1.0", |
| 25 | + "description": "spring-cloud-stream-redis doc", |
| 26 | + "main": "index.js", |
| 27 | + "scripts": { |
| 28 | + "docs:dev": "vuepress dev docs", |
| 29 | + "docs:build": "vuepress build docs" |
| 30 | + }, |
| 31 | + "repository": { |
| 32 | + "type": "git", |
| 33 | + "url": "git+https://github.com/guoshiqiufeng/spring-cloud-stream-redis.git" |
| 34 | + }, |
| 35 | + "keywords": [ |
| 36 | + "spring-cloud-stream", |
| 37 | + "spring-cloud-stream-redis" |
| 38 | + ], |
| 39 | + "author": "guoshiqiufeng", |
| 40 | + "license": "MIT", |
| 41 | + "bugs": { |
| 42 | + "url": "https://github.com/guoshiqiufeng/spring-cloud-stream-redis/issues" |
| 43 | + }, |
| 44 | + "homepage": "https://github.com/guoshiqiufeng/spring-cloud-stream-redis#readme", |
| 45 | + "devDependencies": { |
| 46 | + "@vuepress/client": "^2.0.0-rc.0", |
| 47 | + "@vuepress/plugin-docsearch": "^2.0.0-rc.3", |
| 48 | + "vue": "^3.3.8", |
| 49 | + "vuepress": "^2.0.0-rc.0" |
| 50 | + }, |
| 51 | + "dependencies": { |
| 52 | + "@vuepress/bundler-vite": "^2.0.0-rc.2", |
| 53 | + "@vuepress/theme-default": "^2.0.0-rc.0" |
| 54 | + } |
| 55 | + }' > package.json |
| 56 | +
|
| 57 | + - name: Setup Node.js |
| 58 | + uses: actions/setup-node@v4 |
| 59 | + with: |
| 60 | + # 选择要使用的 node 版本 |
| 61 | + node-version: 20 |
| 62 | + |
| 63 | + - name: Build VuePress site |
| 64 | + run: | |
| 65 | + npm install |
| 66 | + npm run docs:build |
| 67 | +
|
| 68 | + # 查看 workflow 的文档来获取更多信息 |
| 69 | + # @see https://github.com/crazy-max/ghaction-github-pages |
| 70 | + - name: Deploy to GitHub Pages |
| 71 | + uses: crazy-max/ghaction-github-pages@v4 |
| 72 | + with: |
| 73 | + # 部署到 gh-pages 分支 |
| 74 | + target_branch: gh-pages |
| 75 | + # 部署目录为 VuePress 的默认输出目录 |
| 76 | + build_dir: docs/.vuepress/dist |
| 77 | + env: |
| 78 | + # @see https://docs.github.com/cn/actions/reference/authentication-in-a-workflow#about-the-github_token-secret |
| 79 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments