Skip to content

Commit d34e943

Browse files
committed
Update CodeFlare operator to latest MCAD dev after every merged commit
1 parent d2e3fd0 commit d34e943

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

Diff for: .github/workflows/update-codeflare-operator.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Update CodeFlare operator with latest changes from MCAD
2+
3+
on:
4+
workflow_run:
5+
workflows: [Build and Push dev MCAD image into Quay]
6+
types:
7+
- completed
8+
9+
jobs:
10+
update-codeflare-operator:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: checkout MCAD code
15+
uses: actions/checkout@v3
16+
with:
17+
path: 'mcad'
18+
19+
- name: Store latest MCAD Git SHA
20+
run: |
21+
echo "GIT_COMMIT_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
22+
working-directory: mcad
23+
24+
- name: checkout CodeFlare operator code
25+
uses: actions/checkout@v3
26+
with:
27+
repository: 'project-codeflare/codeflare-operator'
28+
token: ${{ env.GITHUB_TOKEN }}
29+
path: operator
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
32+
33+
- name: Update CodeFlare operator code to use latest MCAD version
34+
run: |
35+
sed -i -E "s/(.*MCAD_VERSION \?= ).*/\1${{ env.GIT_COMMIT_SHA }}/" Makefile
36+
sed -i -E "s/(.*MCAD_REF \?= ).*/\1dev/" Makefile
37+
make modules
38+
go mod tidy
39+
working-directory: operator
40+
41+
- name: Commit CodeFlare operator changes in the code back to repository
42+
uses: stefanzweifel/git-auto-commit-action@v4
43+
with:
44+
commit_message: Update MCAD to latest dev
45+
create_branch: true
46+
repository: operator
47+
branch: dev
48+
push_options: '--force'
49+
50+
- name: Create a PR in CodeFlare operator repo with code changes if not opened yet
51+
run: |
52+
if [[ $(gh pr view dev) && $(gh pr view dev --json state --jq .state) == "OPEN" ]]; then
53+
echo "PR already opened"
54+
else
55+
gh pr create --base "main" --fill --head dev
56+
fi
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
59+
working-directory: operator

0 commit comments

Comments
 (0)