-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (79 loc) · 2.98 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---
name: monorepo
on:
push:
branches:
- main
jobs:
monorepo-job:
runs-on: ubuntu-20.04
permissions:
contents: write
container:
image: gcr.io/bazel-public/bazel:7.0.0
volumes:
- /usr/bin/docker:/usr/bin/docker
- /var/run/docker.sock:/var/run/docker.sock
options: -e USER="root" -u="root"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup git config
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Login to GitHub Container Registry
run: echo ${{ secrets.GH_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Fetch bazel cache
uses: actions/cache@v3
with:
path: /tmp/cache
key: bazel-cache
restore-keys: |
bazel-cache
- name: Bazel test
run: bazel --output_user_root=/tmp/cache test --test_output=errors //...
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Upgrade new charts version and appVersions
id: upgrade
run: |
chartsToUpgrade=$(bazel --output_user_root=/tmp/cache query --keep_going --noshow_progress "filter("apply_chart", kind("write_source_file", //apps/...))" 2>/dev/null)
echo $chartsToUpgrade
for chartToUpgrade in $chartsToUpgrade
do
bazel --output_user_root=/tmp/cache run --config=release $chartToUpgrade
done
echo "changes=$(git status --porcelain | wc -l)" >> "$GITHUB_OUTPUT"
- name: Commit new charts version and appVersions
if: steps.upgrade.outputs.changes > 0
run: |
git config --local user.email "[email protected]"
git config --local user.name "bot"
git commit -a -m "chore: [skip ci] Upgrade charts versions and appVersions"
- name: Push new charts version and appVersions
if: steps.upgrade.outputs.changes > 0
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GH_TOKEN }}
branch: ${{ github.ref }}
- name: Bazel test apps
if: steps.upgrade.outputs.changes > 0
run: bazel --output_user_root=/tmp/cache test --test_output=errors //apps/...
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Bazel release components
run: |
for toRelease in $(bazel --output_user_root=/tmp/cache query --keep_going --noshow_progress "filter("release_me", kind("sh_binary", //...))")
do
bazel --output_user_root=/tmp/cache run $toRelease
done
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Bazel release images
run: |
for oci_push in $(bazel --output_user_root=/tmp/cache query --output=label "kind("oci_push", //...)")
do
bazel --output_user_root=/tmp/cache run --config=release $oci_push
done
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}