Coder Social home page Coder Social logo

madordie / auto-update-iconfont Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 1.69 MB

让设计师自己更新iconfont。为的是多人开发的时候iconfont的更新会有冲突。

Swift 75.05% Ruby 0.55% Python 14.35% Shell 10.06%
iconfont iconfont-platform

auto-update-iconfont's Introduction

auto-update-iconfont

让设计师自己更新iconfont。为的是多人开发的时候iconfont的更新会有冲突。。所以简单点。。(代码上传逻辑扔在了Jenkins上。此处只有触发)

主要逻辑

其实就一行:

struct Item {
    let name: String
    let file: String
    let jenkins: String

    func post(_ path: String) -> String {
        return "curl -u USERID:APITOKEN -X POST http://10.12.12.10:8080/job/\(jenkins)/build  --form file0=@\(path) --form json='{\"parameter\": [{\"name\":\"\(file)\", \"file\":\"file0\"},{\"name\":\"from\", \"value\":\"\(NSUserName())\"}]}'"
    }
}

需要注意的是curl后面的USERID:APITOKENUser IDAPI Token,可在用户管理相关界面取到。

Jenkins配置

  1. Jenkins 需要的插件:
  1. 参数构建配置
String Parameter:
  name: from
  default: ""
  desc: "默认使用登录用户~"

String Parameter:
  name: iconfont.ttf
  desc: "请上传iconfont.ttf字体库"
  1. 构建执行脚本 事先已经将项目clone到了指定目录下。 剩下就是几个shell命令,自己看下就能看懂。
# 任务名字
JOB_NAME="iOS项目"
# path
GIT_PATH="ios-app"
# 原来的iconfont地址
OLD_FONT="Resources/Fonts"
# 提交分支
BRANCH="develop"
# 谁可以review
REVIEWERS="${IOS_REVIEWERS}"

# 钉钉机器人token 如需添加换行并列即可
cat << EOF > dtalk.tokens
41xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx96
EOF

#############################
#							#
#     从这里往下就别修改了	 #
#							#
#############################

# 标签
NEW_FONT="iconfont.ttf"
# 项目
JOB="$JOB_NAME($NODE_NAME)"

bash "${HOME}/cmd/push-iconfont-ttf.sh" \
	-j "$JOB_NAME" \
    -n "$NEW_FONT" \
    -o "$OLD_FONT" \
    -b "$BRANCH" \
    -p "$GIT_PATH" \
    -f "$from" \
    -r "$REVIEWERS" \
    -d dtalk.tokens

用作校验 提取iconfont中支持的unicode 以及 代码中支持的unicode

配置在jenkins 中

# check iconfont.ttf
python /Users/User/.jenkins/workspace/lib/checkIconfont.py $TTF_PATH/iconfont.ttf  $CODE_PATH

记得过滤代码中一些特殊含义的unicode,正则可能误伤。。

auto-update-iconfont's People

Contributors

madordie avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.