From 290b274ffcc0382c33494a9fe6d0b5f4783b33f4 Mon Sep 17 00:00:00 2001 From: wangqizheng01 Date: Tue, 15 Dec 2020 21:18:17 +0800 Subject: [PATCH 1/2] feat: custom commit message --- README.md | 4 +++- README.zh-CN.md | 5 +++-- entrypoint.sh | 9 ++++++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 70996d2..31447df 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ jobs: TARGET_BRANCH: master BUILD_SCRIPT: yarn && yarn build BUILD_DIR: blog/.vuepress/dist/ + COMMIT_MESSAGE: 'Auto deploy from Github Actions' ``` The action will auto deploy the vuepress project when you push your code. Enjoy!!! @@ -69,7 +70,8 @@ There are three situations. Each situation corresponds to a deployment file. | `TARGET_LINK` | The full address of the target repo will cover `TARGET_REPO` for other platforms. e.g.:`https://user:${{ secrets.CODING_TOKEN }}@team.coding.net/team/repo.git`. | `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** | +| `COMMIT_MESSAGE` | The commit message supplied when pushing new changes e.g.: `Auto deploy from Github Actions` | `env` | **No** | +| `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 a6e78a0..da53adb 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -69,8 +69,9 @@ jobs: | `TARGET_BRANCH` | 目标仓库的分支,例:`gh-pages`。**默认 gh-pages**| `env` | **否** | | `TARGET_LINK` | 目标仓库的完整链接,会覆盖目标仓库,用于其他平台,例:`https://user:${{ secrets.CODING_TOKEN }}@team.coding.net/team/repo.git`| `env` | **否** | | `BUILD_SCRIPT` | 构建脚本 例: `yarn && yarn build` | `env` | **是** | -| `BUILD_DIR` | 构建产物的目录 e.g.: `blog/.vuepress/dist/` | `env` | **是** | -| `CNAME` | Github Pages 站点别名 | `env` | **no** | +| `BUILD_DIR` | 构建产物的目录 例: `blog/.vuepress/dist/` | `env` | **是** | +| `COMMIT_MESSAGE` | 自动部署时的提交信息 例: `Auto deploy from Github Actions` | `env` | **否** | +| `CNAME` | Github Pages 站点别名 | `env` | **否** | ## 详细教程 ### 创建token diff --git a/entrypoint.sh b/entrypoint.sh index 4c0c48c..00d2553 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -53,8 +53,15 @@ fi echo "==> Starting deploying" +# Final repository +if [[ -z "$COMMIT_MESSAGE" ]]; then + COMMIT_MSG="Auto deploy from Github Actions" +else + COMMIT_MSG="$COMMIT_MESSAGE" +fi + git add . -git commit -m 'Auto deploy from Github Actions' +git commit -m $COMMIT_MSG git push --force $DEPLOY_REPO master:$DEPLOY_BRAN rm -fr .git From 887a139c6c8a124a0fcd7b30eb4fec57278f34d6 Mon Sep 17 00:00:00 2001 From: wangqizheng01 Date: Tue, 15 Dec 2020 21:18:17 +0800 Subject: [PATCH 2/2] feat: custom commit message --- README.md | 4 +++- README.zh-CN.md | 5 +++-- entrypoint.sh | 9 ++++++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 70996d2..31447df 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ jobs: TARGET_BRANCH: master BUILD_SCRIPT: yarn && yarn build BUILD_DIR: blog/.vuepress/dist/ + COMMIT_MESSAGE: 'Auto deploy from Github Actions' ``` The action will auto deploy the vuepress project when you push your code. Enjoy!!! @@ -69,7 +70,8 @@ There are three situations. Each situation corresponds to a deployment file. | `TARGET_LINK` | The full address of the target repo will cover `TARGET_REPO` for other platforms. e.g.:`https://user:${{ secrets.CODING_TOKEN }}@team.coding.net/team/repo.git`. | `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** | +| `COMMIT_MESSAGE` | The commit message supplied when pushing new changes e.g.: `Auto deploy from Github Actions` | `env` | **No** | +| `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 a6e78a0..da53adb 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -69,8 +69,9 @@ jobs: | `TARGET_BRANCH` | 目标仓库的分支,例:`gh-pages`。**默认 gh-pages**| `env` | **否** | | `TARGET_LINK` | 目标仓库的完整链接,会覆盖目标仓库,用于其他平台,例:`https://user:${{ secrets.CODING_TOKEN }}@team.coding.net/team/repo.git`| `env` | **否** | | `BUILD_SCRIPT` | 构建脚本 例: `yarn && yarn build` | `env` | **是** | -| `BUILD_DIR` | 构建产物的目录 e.g.: `blog/.vuepress/dist/` | `env` | **是** | -| `CNAME` | Github Pages 站点别名 | `env` | **no** | +| `BUILD_DIR` | 构建产物的目录 例: `blog/.vuepress/dist/` | `env` | **是** | +| `COMMIT_MESSAGE` | 自动部署时的提交信息 例: `Auto deploy from Github Actions` | `env` | **否** | +| `CNAME` | Github Pages 站点别名 | `env` | **否** | ## 详细教程 ### 创建token diff --git a/entrypoint.sh b/entrypoint.sh index 4c0c48c..bee3d4d 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -53,8 +53,15 @@ fi echo "==> Starting deploying" +# Final repository +if [[ -z "$COMMIT_MESSAGE" ]]; then + COMMIT_MSG="Auto deploy from Github Actions" +else + COMMIT_MSG="$COMMIT_MESSAGE" +fi + git add . -git commit -m 'Auto deploy from Github Actions' +git commit -m "$COMMIT_MSG" git push --force $DEPLOY_REPO master:$DEPLOY_BRAN rm -fr .git