diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e327e57..483efdb 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -14,8 +14,22 @@ on: types: - completed workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + jobs: - Actions-Hugo-Deploy: + # Build job + build: runs-on: ubuntu-latest steps: - name: Check out repository code @@ -23,21 +37,29 @@ jobs: with: submodules: true # Fetch Hugo themes (true OR recursive) fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod - - name: Setup Hugo uses: peaceiris/actions-hugo@v3 with: hugo-version: latest extended: true - - - name: Build + - name: Hugo build run: hugo --gc --minify --logLevel info - - - name: Deploy to Github Pages - uses: JamesIves/github-pages-deploy-action@v4 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 with: - # See https://github.com/JamesIves/github-pages-deploy-action#configuration- - branch: gh-pages - folder: public - clean: true - single-commit: true + # Upload only the public directory + path: './public' + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/checkout@v4 + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 + diff --git a/.gitignore b/.gitignore index b9c04d0..630fcba 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ public/ resources/ .hugo_build.lock +_vendor +jsconfig.json diff --git a/README.en.md b/README.en.md index 3cc5a26..1b0a677 100644 --- a/README.en.md +++ b/README.en.md @@ -41,6 +41,14 @@ For a complete quick start, see this [page](https://fixit.lruihao.cn/documentati git clone --recursive https://github.com//.git ``` +> [!TIP] +> The repository name determines your GitHub Pages URL, for example: +> +> | Repository Name | GitHub Pages | +> | :--- | :--- | +> | `.github.io` | `https://.github.io/` | +> | `blog` | `https://.github.io/blog/` | + ### Launching the Site ```bash @@ -60,11 +68,13 @@ hugo ### Deploy to GitHub Pages -1. Head to Setting => Actions => General => Workflow permissions => Check "Read and write permissions". -2. Manually run Workflow: Actions => Hugo build and deploy => Click Run workflow button. -3. GitHub Pages settings: Setting => Pages => Source: Deploy from a branch => Branch: `gh-pages` => Save. +> [!NOTE] +> You may have noticed that the first automatic deployment of GitHub Actions after the template initialization failed. This is because you have not configured Workflow permissions and GitHub Pages. -> Only need to manually run the Workflow the first time you deploy, and it will be automatically deployed every time you push to the `main` branch. +1. Head to Setting => Actions => General => Workflow permissions => Check "Read and write permissions". +2. GitHub Pages settings: Setting => Pages => Source: GitHub Actions. +3. Modify `config/_default/hugo.toml` file `baseURL` to your site URL. +4. Commit the changes from the previous step to the `main` branch, and GitHub Actions will automatically build and deploy the site to GitHub Pages. ### Update theme diff --git a/README.md b/README.md index 1d2d0ea..87640e0 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,14 @@ git clone --recursive https://github.com//.git ``` +> [!TIP] +> 仓库名决定了你的 GitHub Pages URL,例如: +> +> | 仓库名 | GitHub Pages | +> | :--- | :--- | +> | `.github.io` | `https://.github.io/` | +> | `blog` | `https://.github.io/blog/` | + ### 启动站点 ```bash @@ -60,11 +68,13 @@ hugo ### 部署到 GitHub Pages -1. 转到 Setting => Actions => General => Workflow permissions => 选中 "Read and write permissions"。 -2. 手动运行 Workflow: Actions => Hugo build and deploy => 点击 Run workflow 按钮。 -3. GitHub Pages 设置:Setting => Pages => Source: Deploy from a branch => Branch: `gh-pages` => Save。 +> [!NOTE] +> 聪明的你可能已经注意到,模板初始化后的第一次 GitHub Actions 自动部署失败了。这是因为你还没有配置 Workflow 权限和 GitHub Pages。 -> 只有第一次部署时需要手动运行 Workflow,之后每次推送到 `main` 分支都会自动部署。 +1. 转到 Setting => Actions => General => Workflow permissions => 选中 "Read and write permissions"。 +2. GitHub Pages 设置:Setting => Pages => Source: GitHub Actions。 +3. 修改 `config/_default/hugo.toml` 文件中的 `baseURL` 为你的站点 URL。 +4. 提交上一步的修改到 `main` 分支,GitHub Actions 将自动打包并部署站点到 GitHub Pages。 ### 更新主题 diff --git a/content/posts/hello-world.md b/content/posts/hello-world.md index 60ffcc7..eee08da 100644 --- a/content/posts/hello-world.md +++ b/content/posts/hello-world.md @@ -6,8 +6,6 @@ tags: - FixIt categories: - hello -code: - maxShownLines: 11 # See details front matter: https://fixit.lruihao.cn/documentation/content-management/introduction/#front-matter --- @@ -15,81 +13,12 @@ Welcome to Hugo FixIt! This is your very first post. +## Documentation + Head to the documentation page linked below for a complete guidence to get started with the [FixIt](https://github.com/hugo-fixit/FixIt) theme. {{< fixit-docs-bookmark >}} -## Quick Start - -For a complete quick start, see this [page](https://fixit.lruihao.cn/documentation/getting-started/). - -### Prerequisites - -[Hugo](https://gohugo.io/installation/): >= 0.132.0 (extended version) - -### Use this Template - -1. Click [**Use this template**](https://github.com/hugo-fixit/hugo-fixit-starter1/generate), and create your repository on GitHub. - - image - -2. Once the repository is created, just clone and enjoy it! - - ```bash - # Clone with your own repository url - git clone --recursive https://github.com//.git - ``` - -### Launching the Site - -```bash -# Development environment -hugo server -# Production environment -hugo server -e production -``` - -### Build the Site - -When your site is ready to deploy, run the following command: - -```bash -hugo -``` - -### Deploy to GitHub Pages - -1. Head to Setting => Actions => General => Workflow permissions => Check "Read and write permissions". -2. Manually run Workflow: Actions => Hugo build and deploy => Click Run workflow button. -3. GitHub Pages settings: Setting => Pages => Source: Deploy from a branch => Branch: `gh-pages` => Save. - -> Only need to manually run the Workflow the first time you deploy, and it will be automatically deployed every time you push to the `main` branch. - -### Update theme - -Afterwards you can upgrade the theme with the following command: - -```bash -# Update theme manually -git submodule update --remote --merge themes/FixIt -``` - -
- Start via NPM script - - ```bash - # build the blog - npm run build - # run a local debugging server with watch - npm run server - # run a local debugging server in production environment - npm run server:production - # update theme submodules - npm run update:theme - ``` - -
- ## Feedback Whether it's questions, ideas, bugs or pull requests, all feedback is welcome! diff --git a/themes/shortcode-docs-bookmark b/themes/shortcode-docs-bookmark index 3f53c53..65eb428 160000 --- a/themes/shortcode-docs-bookmark +++ b/themes/shortcode-docs-bookmark @@ -1 +1 @@ -Subproject commit 3f53c538a3777c00e81d1150fa599b95616cc38f +Subproject commit 65eb428072a19d07620058971070274b00fe4043