Skip to content

Commit b86de86

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

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

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

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

0 commit comments

Comments
 (0)