diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3087807 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM python:3.7-slim + +ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONUNBUFFERED 1 + +RUN pip install --upgrade --no-cache-dir requests + +COPY "entrypoint.sh" "/entrypoint.sh" +RUN chmod +x /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/README.md b/README.md index 88a4768..b137324 100644 --- a/README.md +++ b/README.md @@ -1 +1,45 @@ -# gitee-pages-action \ No newline at end of file +# Gitee Pages action +使用模拟登录,自动部署 Gitee Pages。 + +> 未完成。 + +## 入参 + +| 参数 | 描述 | 是否必传 | 默认值 | +|---|---|---|---| +| `gitee-repo` | Gitee 仓库 | 是 | - | +| `gitee-login-cookie` | Gitee 登录后的 cookie | 是 | - | +| `branch` | 构建的分支 | 否 | `master` | +| `directory` | 构建的目录 | 否 | '' | +| `https` | 是否强制 HTTPS | 否 | `false` | + +## 例子 +```yml +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Sync to Gitee + uses: wearerequired/git-mirror-action@master + env: + SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }} + with: + source-repo: "git@github.com:doocs/advanced-java.git" + destination-repo: "git@gitee.com:Doocs/advanced-java.git" + + - name: Rebuild Gitee Pages + uses: yanglbme/gitee-pages-action@v1.0.0 + with: + repository: doocs/advanced-java + cookie: ${{ secrets.GITEE_COOKIE }} + branch: master +``` + +请到 `Settings` -> `Secrets` 配置 `GITEE_RSA_PRIVATE_KEY` 和 `GITEE_COOKIE`。其中: + +- `GITEE_RSA_PRIVATE_KEY`: 存放你的 `id_rsa` 私钥。 +- `GITEE_COOKIE`: 存放你登录 Gitee 后的 Cookie。 + +![](/images/add_secret_key.png) diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..42e6ebb --- /dev/null +++ b/action.yml @@ -0,0 +1,31 @@ +name: 'Gitee Pages Action' +description: 'GitHub Action for Gitee Pages' +author: 'yanglbme' +branding: + icon: 'git-branch' + color: 'gray-dark' +inputs: + gitee-repo: + description: 'The Gitee repository, like doocs/leetcode' + required: true + gitee-login-cookie: + description: 'The Gitee login cookie, like gitee-session-n=BAh7CUkiD...' + required: true + branch: + description: 'Which branch to build' + required: false + default: 'master' + directory: + description: 'Which directory to build' + required: false + default: '' + https: + description: 'Use force https or not' + required: false + default: true +outputs: + result: + description: 'The result of api' +runs: + using: 'docker' + image: 'Dockerfile' \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..cf5a831 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,3 @@ +#!/bin/sh -l + +echo "Hello $1" \ No newline at end of file diff --git a/images/add_secret_key.png b/images/add_secret_key.png new file mode 100644 index 0000000..231198a Binary files /dev/null and b/images/add_secret_key.png differ