Giter VIP home page Giter VIP logo

gitee-pages-action's Introduction

Gitee Pages Action

actions status release license 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/ 下创建一个工作流,引入一些配置参数即可。若有使用上的问题,欢迎随时在 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: "[email protected]:doocs/advanced-java.git"
          # 注意替换为你的 Gitee 目标仓库地址
          destination-repo: "[email protected]: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 官网,并为我们点击了项目的部署按钮。

注:

  1. 如果在使用过程中遇到了 Gitee 短信验证码导致 Gitee Pages Action 无法自动登录部署 Pages,请参考 #6
  2. Gitee 仓库名严格区分大小写,配置 Action 入参 gitee-repo 时请注意准确填写,详情请参考 #10

谁在使用


蚂蚁金服 - 数据可视化

Doocs技术社区

有赞

FAQ

请查看这里

许可证

MIT

gitee-pages-action's People

Contributors

yanglbme avatar imgbotapp avatar hamyct avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.