Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

GitLab-CI微信小程序进行持续集成和持续部署 | zacks's blog #7

Open
zacksleo opened this issue Apr 18, 2018 · 11 comments
Open

Comments

@zacksleo
Copy link
Owner

https://zacksleo.github.io/2018/04/08/GitLab-CI%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F%E8%BF%9B%E8%A1%8C%E6%8C%81%E7%BB%AD%E9%9B%86%E6%88%90%E5%92%8C%E6%8C%81%E7%BB%AD%E9%83%A8%E7%BD%B2/

@Gala-1024
Copy link

如果ci打包在服务器上,是不是只能把文件下载到本地,然后手动上传小程序发布?

@zacksleo
Copy link
Owner Author

CI有两步,第一步在服务器上打包,这台服务器是任意的,第二步部署的时候,需要指定在本机上运行(运行时会自动下载上一步打包的文件),这时候就可以调用微信开发者工具自动上传了

@Gala-1024
Copy link

�好的谢谢,因为我gitlab runner是share runner,公司内网的gitlab上面使用的,跟你的配置不太一样。�
请问有办法实现获取HTTP服务的端口,并且调用上传的API吗?

@zacksleo
Copy link
Owner Author

你可能对gitlab-runner不熟悉,CI部署时,需要本机(mac/windows)安装gitlab-runner并注册到你们公司的gitlab。 然后CI的时候,让gitlab 调本机上的runner,在本机运行部署,相当于替你手动完成了这一步(登录你的电脑并运行命令)

即使是内网,本机连上内网后,本机的runner也是可用的

获取端口和调用上传,见deploy部分的script和参考文档

# 获取HTTP服务的端口, 该端口是不固定的
- PORT=`cat ~/Library/Application\ Support/微信web开发者工具/Default/.ide`
# 调用上传的API
- curl http://127.0.0.1:$PORT/upload\?projectpath\=$PWD/dist\&version\=1.0.0\&desc\=audo-deploy

@Gala-1024
Copy link

好的谢谢,我去自己的服务器上面测试一下。

@Gala-1024
Copy link

你好,runner跑起来了。但是自动上传的时候出现了一个错误
{"code":40000,"error":"错误 {"code":400003,"error":"已存在相同 AppID 和 projectname 的项目(路径),请修改后重试"}"}

我的小程序用的是wepy框架构建的项目,会有什么影响吗?

@Gala-1024
Copy link

可以了。发布成功了!谢谢!

@Gala-1024
Copy link

有时候会出现:{"code":40000,"error":"错误 Error: 缺少文件, error: /app.json not found"}Creating cache master...
node_modules/: found 12691 matching files

@zacksleo
Copy link
Owner Author

@cgygd 这应该是你CI配置的问题了,注意要用artifacts,不要用cache GitLab-CI中的artifacts使用研究

@Gala-1024
Copy link

@zacksleo �好的,thx。
对于使用share runner有解决办法吗?
现在的做法,跑的runner是我本机mac的,这样做没问题。
但是在实际项目中,跑的可能是某一台linux服务器的runner

@zacksleo
Copy link
Owner Author

所以需要通过tags来指定部署用的runner呀,然后传递文件用artifacts,不要用cache

@zacksleo zacksleo reopened this Jul 23, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants