Skip to content

Commit b388484

Browse files
authored
Add approver requirement for the release; simplify code release (#2896)
* Requires an approver to start a release. * Update release_code to only push a tag; code pushing is not needed due to mirroring.
1 parent 6901ef7 commit b388484

File tree

5 files changed

+61
-16
lines changed

5 files changed

+61
-16
lines changed

.github/workflows/release.yaml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,27 @@ jobs:
2424
models: none # only enable unit tests
2525
use_public_wheel: true
2626

27+
approve:
28+
name: Approve Release
29+
if: ${{ inputs.target == 'prod' }}
30+
needs: [test_public_wheel]
31+
runs-on: ubuntu-latest
32+
timeout-minutes: 30
33+
environment: release
34+
steps:
35+
- run: echo "Release approved"
36+
2737
release_code:
2838
name: Release code to Repository
2939
secrets: inherit
30-
needs: [test_public_wheel]
40+
needs: [approve]
3141
uses: ./.github/workflows/release_code.yaml
3242

3343
release_pypi:
3444
name: Release wheel to ${{ inputs.target == 'prod' && 'PyPi' || 'test PyPi' }}
3545
secrets: inherit
36-
needs: [test_public_wheel]
46+
needs: [approve]
47+
if: ${{ !cancelled() && (needs.approve.result == 'success' || needs.approve.result == 'skipped') }}
3748
uses: ./.github/workflows/release_pypi.yaml
3849
with:
3950
target: ${{ inputs.target }}
@@ -42,21 +53,21 @@ jobs:
4253
name: Release Hugging Face Model Cards
4354
if: ${{ inputs.target == 'prod' }}
4455
secrets: inherit
45-
needs: [test_public_wheel]
56+
needs: [approve]
4657
uses: ./.github/workflows/release_huggingface.yaml
4758

4859
release_assets:
4960
name: Release Assets
5061
if: ${{ inputs.target == 'prod' }}
5162
secrets: inherit
52-
needs: [test_public_wheel]
63+
needs: [approve]
5364
uses: ./.github/workflows/release_assets.yaml
5465

5566
sync_public_website:
5667
name: Sync Public Website & Create Public Website PR
5768
secrets: inherit
5869
if: ${{ inputs.target == 'prod' }}
59-
needs: [test_public_wheel]
70+
needs: [approve]
6071
uses: ./.github/workflows/release_website.yml
6172
with:
6273
source_branch_name: ${{ github.ref }}

.github/workflows/release_assets.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,19 @@ env:
1111
VENV_PATH: build/ci-envs/release
1212

1313
jobs:
14+
approve:
15+
if: github.event_name == 'workflow_dispatch'
16+
name: Approve Release
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 30
19+
environment: release
20+
steps:
21+
- run: echo "Release approved"
22+
1423
release_assets:
1524
name: Release - Assets
25+
needs: [approve]
26+
if: ${{ !cancelled() && (needs.approve.result == 'success' || needs.approve.result == 'skipped') }}
1627
runs-on: [tetra-ubuntu-2204, self-hosted]
1728
permissions:
1829
id-token: write # Required for OIDC auth to AWS

.github/workflows/release_code.yaml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,19 @@ on:
1313
workflow_call:
1414

1515
jobs:
16+
approve:
17+
if: github.event_name == 'workflow_dispatch'
18+
name: Approve Release
19+
runs-on: ubuntu-latest
20+
timeout-minutes: 30
21+
environment: release
22+
steps:
23+
- run: echo "Release approved"
24+
1625
release_code_repo:
1726
name: Release Code
27+
needs: [approve]
28+
if: ${{ !cancelled() && (needs.approve.result == 'success' || needs.approve.result == 'skipped') }}
1829
runs-on: [tetra-ubuntu-2204, self-hosted]
1930

2031
steps:
@@ -27,14 +38,13 @@ jobs:
2738
2839
- uses: actions/checkout@v6
2940

30-
- name: Push to public repository
41+
- name: Push tag to public repository
3142
env:
3243
QAIHM_TAG: ${{ github.ref_name }}
3344
GH_TOKEN: ${{ secrets.PROD_GH_TOKEN }}
3445
run: |
3546
git config --local credential.helper '!f() { echo "username=x-access-token"; echo "password=$GH_TOKEN"; }; f'
3647
git remote add public https://github.com/qualcomm/ai-hub-models.git
37-
git fetch public main --depth=1
3848
3949
FORCE_FLAG=""
4050
if [ "${{ inputs.force }}" == "true" ]; then
@@ -46,14 +56,5 @@ jobs:
4656
fi
4757
fi
4858
49-
# Squash all changes into a single commit on top of public main
50-
git reset public/main
51-
git add -A
52-
git commit -m "$QAIHM_TAG
53-
54-
See https://github.com/qualcomm/ai-hub-models/releases/$QAIHM_TAG for changelog.
55-
56-
Signed-off-by: The AI Hub Models Team <ai-hub-support@qti.qualcomm.com>"
57-
5859
git tag -a $FORCE_FLAG "$QAIHM_TAG" -m "$QAIHM_TAG"
5960
git push $FORCE_FLAG public "$QAIHM_TAG"

.github/workflows/release_huggingface.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,19 @@ on:
1818
description: (Optional) Commit Message
1919

2020
jobs:
21+
approve:
22+
if: github.event_name == 'workflow_dispatch'
23+
name: Approve Release
24+
runs-on: ubuntu-latest
25+
timeout-minutes: 30
26+
environment: release
27+
steps:
28+
- run: echo "Release approved"
29+
2130
release_huggingface:
2231
name: Release HuggingFace Model Cards
32+
needs: [approve]
33+
if: ${{ !cancelled() && (needs.approve.result == 'success' || needs.approve.result == 'skipped') }}
2334
runs-on: [tetra-ubuntu-2204, self-hosted]
2435
env:
2536
QAIHM_CI: "true"

.github/workflows/release_pypi.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,19 @@ env:
2525
VENV_PATH: build/ci-envs/release
2626

2727
jobs:
28+
approve:
29+
if: github.event_name == 'workflow_dispatch' && inputs.target == 'prod'
30+
name: Approve Release
31+
runs-on: ubuntu-latest
32+
timeout-minutes: 30
33+
environment: release
34+
steps:
35+
- run: echo "Release approved"
36+
2837
release_pypi:
2938
name: Release to ${{ inputs.target == 'prod' && 'PyPI' || 'test PyPI' }}
39+
needs: [approve]
40+
if: ${{ !cancelled() && (needs.approve.result == 'success' || needs.approve.result == 'skipped') }}
3041
runs-on: [tetra-ubuntu-2204, self-hosted]
3142

3243
steps:

0 commit comments

Comments
 (0)