From a63b088586c5ed53fde43899bd88e374cd361ecb Mon Sep 17 00:00:00 2001 From: jenkey2011 Date: Tue, 11 Feb 2020 23:23:54 +0800 Subject: [PATCH] Croe: add CHAME paramerter --- README.md | 3 ++- README.zh-CN.md | 4 ++-- entrypoint.sh | 9 ++++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b8c9b72..75dc284 100644 --- a/README.md +++ b/README.md @@ -37,9 +37,10 @@ The action will auto deploy the vuepress project when you push your code. Enjoy! | :------------ | :------------ |:------------ |:------------ | | `ACCESS_TOKEN` | Personal access token | `secrets` | **Yes** | | `TARGET_REPO` | The repository you want to deploy. e.g.:`jenkey2011/blog`. Default: **current repository** | `env` | **No** | -| `TARGET_REPO` | The branch you want to deploy. e.g.:`github-pages`.Default: **github-pages** | `env` | **No** | +| `TARGET_REPO` | The branch you want to deploy. e.g.:`gh-pages`.Default: **gh-pages** | `env` | **No** | | `BUILD_SCRIPT` | The script to build the vuepress project. e.g.: `yarn && yarn build` | `env` | **Yes** | | `BUILD_DIR` | The output of the build-script above. e.g.: `blog/.vuepress/dist/` | `env` | **Yes** | +| `CNAME` | Alias Record of your site. | `env` | **no** | ## Step-by-Step Guide diff --git a/README.zh-CN.md b/README.zh-CN.md index 4721f77..bc84bea 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -37,10 +37,10 @@ jobs: | :------------ | :------------ |:------------ |:------------ | | `ACCESS_TOKEN` | github的token | `secrets` | **是** | | `TARGET_REPO` | 目标仓库,例: `jenkey2011/blog`。**默认当前仓库** | `env` | **否** | -| `TARGET_REPO` | 目标仓库的分支,例:`github-pages`。**默认 github-pages**| `env` | **否** | +| `TARGET_REPO` | 目标仓库的分支,例:`gh-pages`。**默认 gh-pages**| `env` | **否** | | `BUILD_SCRIPT` | 构建脚本 例: `yarn && yarn build` | `env` | **是** | | `BUILD_DIR` | 构建产物的目录 e.g.: `blog/.vuepress/dist/` | `env` | **是** | - +| `CNAME` | Github Pages 站点别名 | `env` | **no** | ## 详细教程 ### 创建token diff --git a/entrypoint.sh b/entrypoint.sh index 99aec6c..d64dd64 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -13,9 +13,6 @@ echo "Build success" echo "==> Changing directory to '$BUILD_DIR' ..." cd $BUILD_DIR -echo "#################################################" -echo "Now deploying to GitHub Pages..." - # Get respository if [[ -z "$TARGET_REPO" ]]; then REPOSITORY_NAME="${GITHUB_REPOSITORY}" @@ -45,6 +42,12 @@ if [ -z "$(git status --porcelain)" ]; then exit 0 fi +# Generate a CNAME file +if [ ! -z "$CNAME" ]; then + echo "Generating a CNAME file..." + echo $CNAME > CNAME +fi + echo "==> Starting deploying" git add .