5 Commits

Author SHA1 Message Date
lizheming b511b81acc 2.0.0 2018-03-23 09:53:35 +08:00
lizheming e38559fd09 remove server chan service 2018-03-23 09:53:12 +08:00
lizheming 3d2f8941f1 rm unnecessary word 2018-01-09 10:26:26 +08:00
lizheming 4dbc0654a7 update dockerfile version 2018-01-09 09:18:28 +08:00
lizheming 7d12e3185c fix readme mistake 2018-01-09 09:08:49 +08:00
6 changed files with 9 additions and 85 deletions
+3 -4
View File
@@ -88,10 +88,10 @@ message
# Secret Reference
wechat\_corpid
wechat_corpid
: The corpid for authorization
wechat\_corp_secret
wechat\_corp\_secret
: The corp secret for authorization
wechat\_agent\_id
@@ -100,14 +100,13 @@ wechat\_agent\_id
wechat\_to\_party
: The party ids to send message
wechat\_to\_user
: The user ids to send the message to
wechat\_to\_tag
: The tag ids to send the message to
wechat\_sckey
wechat_sckey
: SCKEY get from [ServerChan](http://sc.ftqq.com)
# Template Reference
+1 -1
View File
@@ -3,7 +3,7 @@ FROM mhart/alpine-node:8.9.3
LABEL maintainer="lizheming <i@imnerd.org>" \
org.label-schema.name="Drone Wechat Notification" \
org.label-schema.vendor="lizheming" \
org.label-schema.schema-version="1.0"
org.label-schema.schema-version="1.1.0"
WORKDIR /wechat
COPY package.json /wechat/package.json
+2 -29
View File
@@ -7,11 +7,11 @@
[![](https://images.microbadger.com/badges/image/lizheming/drone-wechat.svg)](https://microbadger.com/images/lizheming/drone-wechat)
[![GitHub release](https://img.shields.io/github/release/lizheming/drone-wechat.svg)]()
Drone plugin for sending telegram notifications.
Drone plugin for sending wechat notifications.
## Description
This drone wechat notification plugin builds base on Wechat for Work. You can config your own wechat corp id, or you can get wechat notification quickly with key from [ServerChan](http://sc.ftqq.com). If you use [ServerChan](http://sc.ftqq.com) you need get `SCKEY` before using. After login with Github account you can get `SCKEY` at http://sc.ftqq.com/?c=code.
This drone wechat notification plugin builds base on Wechat for Work.
Read this in other languages: [English](README.md), [简体中文](README.zh-cn.md).
@@ -32,15 +32,11 @@ Read this in other languages: [English](README.md), [简体中文](README.zh-cn.
- `PLUGIN_SAFE`: encrypt message, default is false
- `PLUGIN_MSG_URL`: The link for the text card click
- `PLUGIN_BTN_TEXT`: The text for the button on the card
- `PLUGIN_SCKEY`: SCKEY get from [ServerChan](http://sc.ftqq.com)
- `WECHAT_SCKEY`: alias for `PLUGIN_SCKEY`
- `PLUGIN_TITLE`: Notification title
- `PLUGIN_MESSAGE`: Notification body message, support markdown.
## Usage
### With wechat corp id
```
docker run --rm \
-e PLUGIN_CORPID=corpid \
@@ -69,26 +65,3 @@ docker run --rm \
-e DRONE_JOB_FINISHED=1477550750 \
lizheming/drone-wechat
```
### With server chan key
```
docker run --rm \
-e PLUGIN_SCKEY=xxxx \
-e PLUGIN_TITLE=xxxx \
-e PLUGIN_MESSAGE=xxx \
-e DRONE_REPO_OWNER=lizheming \
-e DRONE_REPO_NAME=drone-wechat \
-e DRONE_COMMIT_SHA=e5e82b5eb3737205c25955dcc3dcacc839b7be52 \
-e DRONE_COMMIT_BRANCH=master \
-e DRONE_COMMIT_LINK=https://github.com/lizheming/drone-wechat/compare/master... \
-e DRONE_COMMIT_AUTHOR=lizheming \
-e DRONE_COMMIT_AUTHOR_EMAIL=secretlzm007@gmail.com \
-e DRONE_BUILD_NUMBER=1 \
-e DRONE_BUILD_STATUS=success \
-e DRONE_BUILD_LINK=http://github.com/lizheming/drone-wechat \
-e DRONE_TAG=1.0.0 \
-e DRONE_JOB_STARTED=1477550550 \
-e DRONE_JOB_FINISHED=1477550750 \
lizheming/drone-wechat
```
+1 -28
View File
@@ -13,7 +13,7 @@ drone 微信消息通知插件。
## 简介
基于微信企业号封装的 drone 微信消息通知插件。你可以设置自己的企业号,也可以使用 [Server酱]( http://sc.ftqq.com/) 来快速配置微信消息通知功能。如果使用 [Server酱]( http://sc.ftqq.com/) 需要在使用前获取密钥。Github 登录后即可在 [发送消息](http://sc.ftqq.com/?c=code) 页面查看。
基于微信企业号封装的 drone 微信消息通知插件。
## 配置说明
@@ -32,15 +32,11 @@ drone 微信消息通知插件。
- `PLUGIN_SAFE`: 表示是否是保密消息,0表示否,1表示是,默认0
- `PLUGIN_MSG_URL`: 点击后跳转的链接。
- `PLUGIN_BTN_TEXT`: 按钮文字。 默认为“详情”, 不超过4个文字,超过自动截断。
- `PLUGIN_SCKEY`: [Server酱](http://sc.ftqq.com) 申请的密钥
- `WECHAT_SCKEY`: `PLUGIN_SCKEY` 别名
- `PLUGIN_TITLE`: 消息卡片标题
- `PLUGIN_MESSAGE`: 消息卡片正文,支持 Markdown。
## 如何使用
### 自行配置微信企业号
```
docker run --rm \
-e PLUGIN_CORPID=corpid \
@@ -68,27 +64,4 @@ docker run --rm \
-e DRONE_JOB_STARTED=1477550550 \
-e DRONE_JOB_FINISHED=1477550750 \
lizheming/drone-wechat
```
### 使用Server酱快速集成
```
docker run --rm \
-e PLUGIN_SCKEY=xxxx \
-e PLUGIN_TITLE=xxxx \
-e PLUGIN_MESSAGE=xxx \
-e DRONE_REPO_OWNER=lizheming \
-e DRONE_REPO_NAME=drone-wechat \
-e DRONE_COMMIT_SHA=e5e82b5eb3737205c25955dcc3dcacc839b7be52 \
-e DRONE_COMMIT_BRANCH=master \
-e DRONE_COMMIT_LINK=https://github.com/lizheming/drone-wechat/compare/master... \
-e DRONE_COMMIT_AUTHOR=lizheming \
-e DRONE_COMMIT_AUTHOR_EMAIL=secretlzm007@gmail.com \
-e DRONE_BUILD_NUMBER=1 \
-e DRONE_BUILD_STATUS=success \
-e DRONE_BUILD_LINK=http://github.com/lizheming/drone-wechat \
-e DRONE_TAG=1.0.0 \
-e DRONE_JOB_STARTED=1477550550 \
-e DRONE_JOB_FINISHED=1477550750 \
lizheming/drone-wechat
```
+1 -22
View File
@@ -21,30 +21,10 @@ const {
PLUGIN_MSG_URL,
PLUGIN_BTN_TEXT,
PLUGIN_SCKEY,
WECHAT_SERVER_CHAN_KEY,
PLUGIN_TITLE,
PLUGIN_MESSAGE
} = process.env;
function sendMsgFromServerChan() {
const SCKEY = PLUGIN_SCKEY || WECHAT_SERVER_CHAN_KEY;
if (!SCKEY) {
return false;
}
request({
url: `https://sc.ftqq.com/${SCKEY}.send`,
qs: {
text: PLUGIN_TITLE,
desp: render(PLUGIN_MESSAGE)
}
});
return true;
}
function getAccessToken() {
const CORPID = PLUGIN_CORPID || WECHAT_CORPID;
const CORP_SECRET = PLUGIN_CORP_SECRET || WECHAT_CORP_SECRET;
@@ -109,9 +89,8 @@ function sendMsgFromWechat() {
});
}
sendMsgFromServerChan() || sendMsgFromWechat();
sendMsgFromWechat();
module.exports = {
sendMsgFromServerChan,
getAccessToken,
sendMsgFromWork,
sendMsgFromWechat
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "drone-wechat",
"version": "1.1.0",
"version": "2.0.0",
"description": "drone wechat notification plugin",
"main": "index.js",
"scripts": {