1 Star 29 Fork 3

heartaotime / gitee-pages-action

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Gitee Pages Action

actions status release license PRs Welcome

使用 GitHub Pages 时,每当项目有更新,GitHub 会自动帮我们重新部署 GitHub Pages。对于国内的 Gitee Pages,一般情况下无法自动部署,除非我们开通 Gitee Pages Pro 功能。而 Pro 功能的开通,需要满足以下其中一个条件:

  • 花钱开通 Pro 功能,¥99/年。
  • Gitee 项目足够优秀,得到 Gitee 官方的推荐,那么 Gitee 就会提示“您的项目为推荐项目,已自动为您开通 Gitee Pages Pro”。

为了帮助更多朋友实现 Gitee Pages 的自动部署,我开发了 Gitee Pages Action,只需要在项目的 Settings 页面下配置 keys,然后在 .github/workflows/ 下创建一个工作流,引入一些配置参数即可。

目前,我维护的多个仓库都使用了 Gitee Pages Action 成功进行自动部署,如:jvm, advanced-java。若有使用上的问题,欢迎随时在 Issues 反馈。

注:首次需要手动登录 Gitee 点击构建。

入参

参数 描述 是否必传 默认值
gitee-username Gitee 用户名 -
gitee-password Gitee 密码 -
gitee-repo Gitee 仓库 -
branch 构建的分支 master
directory 构建的目录 ''
https 是否强制 HTTPS true

示例

以下是一个完整示例。

在你的 GitHub 仓库 .github/workflows/ 文件夹下创建一个 sync.yml 文件,内容如下:

name: Sync

on:
  push:
    branches: [ master ]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Sync to Gitee
      uses: wearerequired/git-mirror-action@master
      env:
          # 注意在 Settings->Secrets 配置 GITEE_RSA_PRIVATE_KEY
          SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }}
      with:
          # 注意替换为你的 GitHub 源仓库地址
          source-repo: "git@github.com:doocs/advanced-java.git"
          # 注意替换为你的 Gitee 目标仓库地址
          destination-repo: "git@gitee.com:Doocs/advanced-java.git"

    - name: Build Gitee Pages
      uses: yanglbme/gitee-pages-action@master
      with:
          # 注意替换为你的 Gitee 用户名
          gitee-username: yanglbme
          # 注意在 Settings->Secrets 配置 GITEE_PASSWORD
          gitee-password: ${{ secrets.GITEE_PASSWORD }}
          # 注意替换为你的 Gitee 仓库
          gitee-repo: doocs/advanced-java

先使用 wearerequired/git-mirror-action 将 GitHub 仓库同步到 Gitee 仓库,再使用 yanglbme/gitee-pages-action 实现 Gitee Pages 的自动部署。

请确保在 GitHub 项目的 Settings -> Secrets 路径下配置好 GITEE_RSA_PRIVATE_KEY 以及 GITEE_PASSWORD 两个密钥。其中:

  • GITEE_RSA_PRIVATE_KEY: 存放你的 id_rsa 私钥。
  • GITEE_PASSWORD: 存放你的 Gitee 账户密码。

如果一切配置正常,并成功触发 Gitee Pages Action ,我们可能会收到一封来自 Gitee 的告警邮件/站内信。放心,这是 GitHub Action 程序帮我们登录到 Gitee 官网,并为我们点击了项目的部署按钮。

许可证

MIT

The MIT License (MIT) Copyright © 2020 <copyright Yang Libin> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

🤖 无须人为干预,自动部署 Gitee Pages 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/heartaotime/gitee-pages-action.git
git@gitee.com:heartaotime/gitee-pages-action.git
heartaotime
gitee-pages-action
gitee-pages-action
master

搜索帮助