Skip to content

Commit 5071300

Browse files
committed
Create GitHub action to automate CodeFlare project release
1 parent 88cd476 commit 5071300

File tree

1 file changed

+154
-0
lines changed

1 file changed

+154
-0
lines changed
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
# This workflow will build and release all components of the CodeFlare project
2+
3+
name: Project CodeFlare Release
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
operator-version:
8+
description: 'CodeFlare operator version to be released (for example: v0.0.0)'
9+
required: true
10+
replaces:
11+
description: 'The previous operator semantic version that this release replaces (for example: v0.0.0)'
12+
required: true
13+
mcad-version:
14+
description: 'Version of multi-cluster-app-dispatcher to be released (for example: v0.0.0)'
15+
required: true
16+
codeflare-sdk-version:
17+
description: 'Version of CodeFlare-SDK to be released (for example: v0.0.0)'
18+
required: true
19+
instascale-version:
20+
description: 'Version of InstaScale to be released (for example: v0.0.0)'
21+
required: true
22+
is-stable:
23+
description: 'Select if the built images should be tagged as stable'
24+
required: true
25+
type: boolean
26+
codeflare-repository-organization:
27+
description: 'GitHub organization/user containing repositories used for release'
28+
required: true
29+
default: 'sutaakar'
30+
quay-organization:
31+
description: 'Quay organization used to push the built images to'
32+
required: true
33+
default: 'ksuta'
34+
community-operators-prod-organization:
35+
description: 'Owner of target community-operators-prod repository used to open a PR against'
36+
required: true
37+
default: 'sutaakar'
38+
39+
jobs:
40+
release-mcad:
41+
runs-on: ubuntu-latest
42+
43+
steps:
44+
- name: Retrieve Token of CodeFlare app
45+
id: workflow-token
46+
uses: peter-murray/workflow-application-token-action@v2
47+
with:
48+
application_id: ${{ secrets.CODEFLARE_BOT_APP_ID }}
49+
application_private_key: ${{ secrets.CODEFLARE_BOT_PRIVATE_KEY }}
50+
51+
- name: Release MCAD
52+
run: |
53+
gh workflow run mcad-release.yml --repo ${{ github.event.inputs.codeflare-repository-organization }}/multi-cluster-app-dispatcher --ref ${{ github.ref }} --field tag=${{ github.event.inputs.mcad-version }}
54+
env:
55+
GITHUB_TOKEN: ${{ steps.workflow-token.outputs.token }}
56+
shell: bash
57+
58+
- name: Wait for MCAD run to finish
59+
run: |
60+
# wait for a while for Run to be started
61+
sleep 5
62+
run_id=$(gh run list --workflow mcad-release.yml --repo ${{ github.event.inputs.codeflare-repository-organization }}/multi-cluster-app-dispatcher --limit 1 --json databaseId --jq .[].databaseId)
63+
gh run watch ${run_id} --repo ${{ github.event.inputs.codeflare-repository-organization }}/multi-cluster-app-dispatcher --interval 10 --exit-status
64+
env:
65+
GITHUB_TOKEN: ${{ github.token }}
66+
shell: bash
67+
68+
release-instascale:
69+
needs: release-mcad
70+
runs-on: ubuntu-latest
71+
72+
steps:
73+
- name: Retrieve Token of CodeFlare app
74+
id: workflow-token
75+
uses: peter-murray/workflow-application-token-action@v2
76+
with:
77+
application_id: ${{ secrets.CODEFLARE_BOT_APP_ID }}
78+
application_private_key: ${{ secrets.CODEFLARE_BOT_PRIVATE_KEY }}
79+
80+
- name: Release InstaScale
81+
run: |
82+
gh workflow run instascale-release.yml --repo ${{ github.event.inputs.codeflare-repository-organization }}/instascale --ref ${{ github.ref }} --field is-stable=${{ github.event.inputs.is-stable }} --field tag=${{ github.event.inputs.instascale-version }} --field mcad-version=${{ github.event.inputs.mcad-version }} --field quay-organization=${{ github.event.inputs.quay-organization }}
83+
env:
84+
GITHUB_TOKEN: ${{ steps.workflow-token.outputs.token }}
85+
shell: bash
86+
87+
- name: Wait for InstaScale run to finish
88+
run: |
89+
# wait for a while for Run to be started
90+
sleep 5
91+
run_id=$(gh run list --workflow instascale-release.yml --repo ${{ github.event.inputs.codeflare-repository-organization }}/instascale --limit 1 --json databaseId --jq .[].databaseId)
92+
gh run watch ${run_id} --repo ${{ github.event.inputs.codeflare-repository-organization }}/instascale --interval 10 --exit-status
93+
env:
94+
GITHUB_TOKEN: ${{ github.token }}
95+
shell: bash
96+
97+
release-codeflare-sdk:
98+
runs-on: ubuntu-latest
99+
100+
steps:
101+
- name: Retrieve Token of CodeFlare app
102+
id: workflow-token
103+
uses: peter-murray/workflow-application-token-action@v2
104+
with:
105+
application_id: ${{ secrets.CODEFLARE_BOT_APP_ID }}
106+
application_private_key: ${{ secrets.CODEFLARE_BOT_PRIVATE_KEY }}
107+
108+
- name: Release CodeFlare SDK
109+
run: |
110+
semver_version="${{ github.event.inputs.codeflare-sdk-version }}"
111+
plain_version="${semver_version:1}"
112+
gh workflow run release.yaml --repo ${{ github.event.inputs.codeflare-repository-organization }}/codeflare-sdk --ref ${{ github.ref }} --field release-version=${plain_version} --field is-latest=${{ github.event.inputs.is-stable }} --field quay-organization=${{ github.event.inputs.quay-organization }}
113+
env:
114+
GITHUB_TOKEN: ${{ steps.workflow-token.outputs.token }}
115+
shell: bash
116+
117+
- name: Wait for CodeFlare SDK run to finish
118+
run: |
119+
# wait for a while for Run to be started
120+
sleep 5
121+
run_id=$(gh run list --workflow release.yaml --repo ${{ github.event.inputs.codeflare-repository-organization }}/codeflare-sdk --limit 1 --json databaseId --jq .[].databaseId)
122+
gh run watch ${run_id} --repo ${{ github.event.inputs.codeflare-repository-organization }}/codeflare-sdk --interval 10 --exit-status
123+
env:
124+
GITHUB_TOKEN: ${{ github.token }}
125+
shell: bash
126+
127+
release-codeflare-operator:
128+
needs: [release-mcad, release-instascale, release-codeflare-sdk]
129+
runs-on: ubuntu-latest
130+
131+
steps:
132+
- name: Retrieve Token of CodeFlare app
133+
id: workflow-token
134+
uses: peter-murray/workflow-application-token-action@v2
135+
with:
136+
application_id: ${{ secrets.CODEFLARE_BOT_APP_ID }}
137+
application_private_key: ${{ secrets.CODEFLARE_BOT_PRIVATE_KEY }}
138+
139+
- name: Release CodeFlare operator
140+
run: |
141+
gh workflow run tag-and-build.yml --repo ${{ github.event.inputs.codeflare-repository-organization }}/codeflare-operator --ref ${{ github.ref }} --field is-stable=${{ github.event.inputs.is-stable }} --field version=${{ github.event.inputs.operator-version }} --field replaces=${{ github.event.inputs.replaces }} --field mcad-version=${{ github.event.inputs.mcad-version }} --field codeflare-sdk-version=${{ github.event.inputs.codeflare-sdk-version }} --field instascale-version=${{ github.event.inputs.instascale-version }} --field quay-organization=${{ github.event.inputs.quay-organization }} --field community-operators-prod-fork-organization=${{ github.event.inputs.codeflare-repository-organization }} --field community-operators-prod-organization=${{ github.event.inputs.community-operators-prod-organization }}
142+
env:
143+
GITHUB_TOKEN: ${{ steps.workflow-token.outputs.token }}
144+
shell: bash
145+
146+
- name: Wait for CodeFlare operator run to finish
147+
run: |
148+
# wait for a while for Run to be started
149+
sleep 5
150+
run_id=$(gh run list --workflow tag-and-build.yml --repo ${{ github.event.inputs.codeflare-repository-organization }}/codeflare-operator --limit 1 --json databaseId --jq .[].databaseId)
151+
gh run watch ${run_id} --repo ${{ github.event.inputs.codeflare-repository-organization }}/codeflare-operator --interval 10 --exit-status
152+
env:
153+
GITHUB_TOKEN: ${{ github.token }}
154+
shell: bash

0 commit comments

Comments
 (0)