使用github操作从Monorepo部署单个服务 [英] Deploy individual services from a monorepo using github actions
问题描述
我大约有10个微服务,主要是用于各种数据处理工作的云功能,所有这些功能都生活在一个github存储库中。
I have around 10 individual micro-services which are mostly cloud functions for various data processing jobs, which all live in a single github repository.
目标是在将单个服务更新后,触发将这些服务选择性地部署到Google Cloud Functions上。
The goal is to trigger the selective deployment of these service to Google Cloud Functions, on push to a branch - when an individual function has been updated.
我必须避免出现以下情况:一项服务会导致所有云功能的部署。
I must avoid the situation in which update of a single service causes the deployment of all the cloud functions.
我当前的存储库结构:
/repo
--/service_A
----/function
----/notebook
--/service_B
----/function
----/notebook
使用Github Actions VS Google Cloud Build进行自动化的优点/缺点?
On a side note, what are the pros/cons of using Github Actions VS Google Cloud Build for such automation?
推荐答案
GitHub Actions支持带有工作流路径过滤的monorepos 。您可以创建工作流,以选择性地触发特定路径上的文件何时发生更改。
GitHub Actions supports monorepos with path filtering for workflows. You can create a workflow to selectively trigger when files on a specific path change.
https://help.github.com/en/articles/workflow-syntax-for-github-actions#onpushpull_requestpaths
例如,当路径 service_A /
下的任何文件已更改时,此工作流将在推送时触发。
For example, this workflow will trigger on a push when any files under the path service_A/
have changed.
on:
push:
paths:
- 'service_A/*'
这篇关于使用github操作从Monorepo部署单个服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!