Skip to content

Commit 985b4ea

Browse files
committed
ci: publish bazel rules snapshots
This commit integrates rules_angular, rules_browsers, and rules_sass into the repository's build and snapshot publishing workflow.
1 parent 84e350c commit 985b4ea

6 files changed

Lines changed: 79 additions & 1 deletion

File tree

.github/workflows/publish-snapshots.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
with:
2929
bazelrc: .bazelrc
3030
- run: pnpm install --frozen-lockfile
31-
- run: pnpm bazel build //ng-dev:npm_package --config=release
31+
- run: bash ./tools/build-all.sh
3232
- name: Publish Snapshots
3333
env:
3434
GITHUB_TOKEN: ${{ secrets.SNAPSHOT_BUILDS_GITHUB_TOKEN }}

.ng-dev/release.mjs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ export const release = {
55
name: '@angular/ng-dev',
66
snapshotRepo: 'dev-infra-private-ng-dev-builds',
77
},
8+
{
9+
name: 'rules_angular',
10+
snapshotRepo: 'rules_angular',
11+
},
12+
{
13+
name: 'rules_browsers',
14+
snapshotRepo: 'rules_browsers',
15+
},
16+
{
17+
name: 'rules_sass',
18+
snapshotRepo: 'rules_sass',
19+
},
820
],
921
buildPackages: async () => {
1022
// TODO: Create a standard build script instead of expecting the build to already be complete
@@ -13,6 +25,18 @@ export const release = {
1325
name: '@angular/ng-dev',
1426
outputPath: './dist/bin/ng-dev/npm_package',
1527
},
28+
{
29+
name: 'rules_angular',
30+
outputPath: './dist/rules/rules_angular',
31+
},
32+
{
33+
name: 'rules_browsers',
34+
outputPath: './dist/rules/rules_browsers',
35+
},
36+
{
37+
name: 'rules_sass',
38+
outputPath: './dist/rules/rules_sass',
39+
},
1640
];
1741
},
1842
};
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# rules_angular
2+
3+
> [!IMPORTANT]
4+
> The source code for this library is maintained in the [angular/dev-infra](https://github.com/angular/dev-infra) repository.
5+
> Please open any issues or pull requests in that repository.

bazel/rules/rules_browsers/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# rules_browsers
22

3+
> [!IMPORTANT]
4+
> The source code for this library is maintained in the [angular/dev-infra](https://github.com/angular/dev-infra) repository.
5+
> Please open any issues or pull requests in that repository.
6+
37
Use browsers in Bazel and run tests with them.
48

59
## Usage

bazel/rules/rules_sass/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# rules_sass
2+
3+
> [!IMPORTANT]
4+
> The source code for this library is maintained in the [angular/dev-infra](https://github.com/angular/dev-infra) repository.
5+
> Please open any issues or pull requests in that repository.

tools/build-all.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
3+
# Bash script to build all packages and modules in the dev-infra repository.
4+
set -e
5+
6+
# Ensure the script runs from the repository root.
7+
cd "$(dirname "$0")/.."
8+
9+
# Build the ng-dev npm package using Bazel in release mode.
10+
echo "Building //ng-dev:npm_package..."
11+
pnpm bazel build //ng-dev:npm_package --config=release
12+
13+
# Package each rule module by creating a git archive and extracting it.
14+
# This ensures that only tracked files are included in the output.
15+
mkdir -p dist
16+
17+
# Create a temporary tree-ish that includes uncommitted changes.
18+
# If no changes exist, git stash create returns empty, so we fall back to HEAD.
19+
tree_ish=$(git stash create)
20+
if [ -z "$tree_ish" ]; then
21+
tree_ish="HEAD"
22+
fi
23+
24+
for rule_path in bazel/rules/rules_*; do
25+
if [ -d "$rule_path" ]; then
26+
rule_name=$(basename "$rule_path")
27+
target_dir="dist/rules/$rule_name"
28+
29+
echo "Packaging $rule_name into $target_dir..."
30+
31+
# Ensure target directory exists and is empty
32+
rm -rf "$target_dir"
33+
mkdir -p "$target_dir"
34+
35+
# Archive the content of the rule directory and extract it into dist.
36+
git archive "$tree_ish":"$rule_path" | tar -x -C "$target_dir"
37+
fi
38+
done
39+
40+
echo "Build all completed successfully."

0 commit comments

Comments
 (0)