Skip to content

Commit 1f3a0df

Browse files
committed
[rules_mc] 添加 rules_mc 的 copybara 配置
1 parent 8b57f6e commit 1f3a0df

File tree

5 files changed

+85
-0
lines changed

5 files changed

+85
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Sync rules_mc to GitHub
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'rules_mc/**'
9+
workflow_dispatch:
10+
flags:
11+
description: Flags to be passed to Copybara
12+
required: false
13+
default: ""
14+
15+
jobs:
16+
sync:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout monorepo
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Set up JDK 21
26+
uses: actions/setup-java@v3
27+
with:
28+
java-version: '21'
29+
distribution: 'temurin'
30+
31+
- name: Setup Android SDK
32+
uses: android-actions/setup-android@v3
33+
34+
- uses: nttld/setup-ndk@v1
35+
id: setup-ndk
36+
with:
37+
ndk-version: r28b
38+
39+
- name: Setup Bazel
40+
uses: bazel-contrib/setup-bazel@0.14.0
41+
42+
- name: Run Copybara sync
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.COPYBARA_RULES_MC_TOKEN }}
45+
FLAGS: ${{ inputs.flags }}
46+
run: |
47+
bazel run --run_under="cd $PWD &&" //copybara:copybara -- copybara/copy.bara.sky rules_mc $FLAGS

MODULE.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ include("//module:android.MODULE.bazel")
101101
# tools
102102
include("//module:mdbook.MODULE.bazel")
103103

104+
include("//module:copybara.MODULE.bazel")
105+
104106
# rules
105107
include("//module:rules.MODULE.bazel")
106108

copybara/BUILD.bazel

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
load("@rules_java//java:java_binary.bzl", "java_binary")
2+
3+
java_binary(
4+
name = "copybara",
5+
main_class = "com.google.copybara.Main",
6+
runtime_deps = ["@com_github_google_copybara//jar"],
7+
)

copybara/copy.bara.sky

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
core.workflow(
2+
name = "rules_mc",
3+
origin = git.origin(
4+
url = "https://github.com/TouchController/TouchController-Monorepo.git",
5+
ref = "master",
6+
),
7+
destination = git.github_destination(
8+
url = "https://github.com/TouchController/rules_mc.git",
9+
),
10+
authoring = authoring.pass_thru("Copybara <copybara@copybara>"),
11+
origin_files = glob(["rules_mc/**"]),
12+
transformations = [
13+
core.move(
14+
"rules_mc",
15+
"",
16+
overwrite = True,
17+
),
18+
],
19+
mode = "ITERATIVE",
20+
set_rev_id = True,
21+
)

module/copybara.MODULE.bazel

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
"""Module extension to download Copybara."""
2+
3+
http_jar = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_jar")
4+
http_jar(
5+
name = "com_github_google_copybara",
6+
sha256 = "d1a43707446e1335a9cb015769e55d086a1954ee2abd0f8bf8187b4b5566241f",
7+
url = "https://github.com/google/copybara/releases/download/v20260119/copybara_deploy.jar",
8+
)

0 commit comments

Comments
 (0)