From b74c9dfc52f4522e2f11a49b974854e20bb73c69 Mon Sep 17 00:00:00 2001 From: aaronlamz Date: Thu, 22 Aug 2024 13:25:43 +0800 Subject: [PATCH 1/6] init github pages --- .github/workflows/deploy.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..019449e --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,35 @@ +name: Deploy to GitHub Pages + +on: + push: + branches: + - main # 当推送到 main 分支时触发 + - dev + +jobs: + build-deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '20' # 确保使用 Node.js 20 + + - name: Install dependencies + run: yarn install + + - name: Build the project + run: yarn build + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./dist/navpress # 部署到 GitHub Pages 的 navpress 目录下 + # 可以根据需要设置 `cname` 参数 + # cname: example.com + destination_dir: navpress # 将构建内容放置在 `navpress` 目录下 \ No newline at end of file From 086e6b13272c5301fbb42f84cff07b9a936aeef9 Mon Sep 17 00:00:00 2001 From: aaronlamz Date: Thu, 22 Aug 2024 13:31:17 +0800 Subject: [PATCH 2/6] fix deploy --- .github/workflows/deploy.yml | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 019449e..adcfbef 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -3,33 +3,30 @@ name: Deploy to GitHub Pages on: push: branches: - - main # 当推送到 main 分支时触发 + - main # 或者你正在使用的其他主分支 - dev +permissions: + contents: write # 确保 GITHUB_TOKEN 有写权限 + pages: write + jobs: - build-deploy: + deploy: runs-on: ubuntu-latest - steps: - name: Checkout code uses: actions/checkout@v3 - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: '20' # 确保使用 Node.js 20 - - name: Install dependencies - run: yarn install + run: yarn install # 或者 npm install - - name: Build the project - run: yarn build + - name: Build project + run: yarn build # 或者 npm run build - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./dist/navpress # 部署到 GitHub Pages 的 navpress 目录下 - # 可以根据需要设置 `cname` 参数 - # cname: example.com - destination_dir: navpress # 将构建内容放置在 `navpress` 目录下 \ No newline at end of file + publish_dir: ./dist + destination_dir: navpress # 部署到 navpress 子目录 + cname: aaronlamz.github.io # 可选: 如果你需要自定义域名 \ No newline at end of file From 2dd8d837823e5090209cd9b2c49f7dc59de95782 Mon Sep 17 00:00:00 2001 From: aaronlamz Date: Thu, 22 Aug 2024 13:33:33 +0800 Subject: [PATCH 3/6] fix node version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c167b5b..a42fb03 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "keywords": ["navpress"], "author": "aaronlamz", "engines": { - "node": ">=20" + "node": ">=18" }, "engineStrict": true, "license": "MIT", From dce395180637fc36cef4d42a605a22338c0ac241 Mon Sep 17 00:00:00 2001 From: aaronlamz Date: Thu, 22 Aug 2024 13:46:21 +0800 Subject: [PATCH 4/6] fix deploy --- .github/workflows/deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index adcfbef..b4b1b7f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -28,5 +28,5 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./dist - destination_dir: navpress # 部署到 navpress 子目录 - cname: aaronlamz.github.io # 可选: 如果你需要自定义域名 \ No newline at end of file + # destination_dir: navpress # 部署到 navpress 子目录,不指定就是根目录 + # cname: aaronlamz.github.io # 可选: 如果你需要自定义域名 \ No newline at end of file From 451bf60f8fe9d3e30d251bda307b4778bdf4e6d6 Mon Sep 17 00:00:00 2001 From: aaronlamz Date: Thu, 22 Aug 2024 13:48:32 +0800 Subject: [PATCH 5/6] fix readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index aac5117..e5d44bb 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ # NavPress [![npm version](https://img.shields.io/npm/v/navpress.svg)](https://www.npmjs.com/package/navpress) +[![Deploy to GitHub Pages](https://github.com/aaronlamz/navpress/actions/workflows/deploy.yml/badge.svg)](https://github.com/aaronlamz/navpress/actions/workflows/deploy.yml) **NavPress** is a CLI tool for generating static navigation websites. It allows you to quickly build a navigation site through a configuration file, supporting both development and production modes. From 076598daf34bc9d604659bbed0735ba8781bb316 Mon Sep 17 00:00:00 2001 From: aaronlamz Date: Thu, 22 Aug 2024 13:50:40 +0800 Subject: [PATCH 6/6] fix readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e5d44bb..61ae2b5 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ - Integrates with Tailwind CSS and Vue.js. ## Preview -![demo](./demo.png) +[View Demo](https://aaronlamz.github.io/navpress/) ## Installation