diff --git a/Dockerfile b/Dockerfile index 05e0182..f8a86e8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,16 @@ FROM node:18.15.0-buster-slim -LABEL version="1.0.0" +LABEL version="1.0.1" LABEL repository="https://github.com/Nicolasking007/hexo-action-pro" LABEL homepage="https://Nicolasking007.github.io" LABEL maintainer="Nicolasking007 " -COPY entrypoint.sh /entrypoint.sh +LABEL "com.github.actions.name"="Hexo Action pro" +LABEL "com.github.actions.description"="Hexo CI/CD action for automating deployment." +LABEL "com.github.actions.icon"="upload-cloud" +LABEL "com.github.actions.color"="green" + +COPY README.md LICENSE entrypoint.sh / COPY sync_deploy_history.js /sync_deploy_history.js RUN apt-get update > /dev/null && \ diff --git a/entrypoint.sh b/entrypoint.sh index 813711a..66226f3 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -13,25 +13,27 @@ git config --global user.name "$INPUT_USER_NAME" git config --global user.email "$INPUT_USER_EMAIL" # 安装 Hexo 环境 +echo ">_ Install NPM dependencies ..." npm install +echo ">_ Clean cache files ..." +npx hexo clean + +echo ">_ Generate file ..." +npx hexo generate + # 部署 if [ "$INPUT_COMMIT_MSG" = "none" ]; then # 避免 hexo-butterfly-douban 构建冲突,使用 hexo g -deploy - hexo clean - hexo g hexo deploy elif [ "$INPUT_COMMIT_MSG" = "" ] || [ "$INPUT_COMMIT_MSG" = "default" ]; then # 拉取原始发布仓库 NODE_PATH=$NODE_PATH:$(pwd)/node_modules node /sync_deploy_history.js - hexo clean - hexo g hexo deploy else # 指定提交消息 NODE_PATH=$NODE_PATH:$(pwd)/node_modules node /sync_deploy_history.js - hexo clean - hexo g -deploy -m "$INPUT_COMMIT_MSG" + hexo deploy -m "$INPUT_COMMIT_MSG" fi echo ::set-output name=notify::"部署完成。"