Skip to content

Commit 1e611de

Browse files
committed
Completed the automation of notebook releases
1 parent 35796a1 commit 1e611de

File tree

3 files changed

+34
-52
lines changed

3 files changed

+34
-52
lines changed

.github/workflows/notebooks-digest-updater.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,28 @@ on: # yamllint disable-line rule:truthy
88
branch:
99
required: false
1010
description: "Optional: Provide branch name"
11+
type: string
1112
user-hash:
1213
required: false
1314
description: "Optional: Specify a Git hash (it should exists on the branch history)"
15+
type: string
16+
workflow_call:
17+
inputs:
18+
branch:
19+
required: false
20+
description: "Optional: Provide branch name"
21+
type: string
22+
user-hash:
23+
required: false
24+
description: "Optional: Specify a Git hash (it should exists on the branch history)"
25+
type: string
1426

1527
env:
16-
USER_HASH: ${{ github.event.inputs.user-hash }}
28+
USER_HASH: ${{ inputs.user-hash }}
1729
REPO_ORG: ${{ github.repository_owner }}
1830
REPO_NAME: 'notebooks'
1931
TMP_BRANCH: tmp-digest-sync-${{ github.run_id }}
20-
BRANCH_NAME: ${{ github.event.inputs.branch || 'main' }}
32+
BRANCH_NAME: ${{ inputs.branch || 'main' }}
2133

2234
jobs:
2335
update-images:

.github/workflows/notebooks-release.yaml

Lines changed: 17 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -22,63 +22,31 @@ on:
2222
required: true
2323
default: 'true'
2424
type: boolean
25-
head_branch:
26-
description: 'head branch for the release'
27-
required: true
28-
default: 'tmp-digest-sync-14488482962'
25+
branch:
26+
description: "Optional: Provide branch name"
27+
required: false
2928
type: string
30-
base_branch:
31-
description: 'Base branch for the release'
32-
required: true
33-
default: 'test'
29+
user-hash:
30+
description: "Optional: Specify a Git hash (it should exists on the branch history)"
31+
required: false
3432
type: string
3533

3634
env:
37-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3835
RELEASE_TAG: ${{ github.event.inputs.tag }}
3936
RELEASE_NAME: ${{ github.event.inputs.release_name }}
40-
BASE_BRANCH: ${{ github.event.inputs.base_branch }}
41-
HEAD_BRANCH: ${{ github.event.inputs.head_branch }}
42-
REPO_OWNER: mtchoum1
37+
BRANCH: ${{ github.event.inputs.branch }}
38+
USER_HASH: ${{ github.event.inputs.user-hash }}
39+
REPO_OWNER: opendatahub-io
4340
REPO_NAME: notebooks
4441
VERSION: ${{ github.event.inputs.buildconfigs_version}}
4542

4643
jobs:
4744
#1. Update the params.env and commit.env files with new SHAs
4845
Update-manifests:
49-
if: github.event_name == 'workflow_dispatch'
50-
runs-on: ubuntu-latest
51-
permissions:
52-
contents: write
53-
pull-requests: write
54-
steps:
55-
- name: Check out repository
56-
uses: actions/checkout@v4
57-
with:
58-
fetch-depth: 0
59-
60-
- name: Configure Git
61-
run: |
62-
git config user.name "GitHub Actions"
63-
git config user.email "github-actions[bot]@users.noreply.github.com"
64-
65-
- name: Create Target Branch
66-
run: |
67-
git checkout -b $BASE_BRANCH
68-
git push origin $BASE_BRANCH
69-
70-
- name: create pull request
71-
run: |
72-
gh pr create -B $BASE_BRANCH -H $HEAD_BRANCH --title "$PR_TITLE" --body "$PR_BODY"
73-
env:
74-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75-
PR_TITLE: "[Updater Action] Update Notebook and Runtime Images as well as the Commits With New SHAs"
76-
PR_BODY: |
77-
:rocket: This is an automated Pull Request.
78-
Created by `/.github/workflows/notebooks-digest-updater.yaml`
79-
- `manifests/base/params.env` file with the latest updated SHA digests of the notebooks.
80-
- `manifests/base/runtime-*.yamls` file with the latest updated SHA digests of the runtimes.
81-
- `manifests/base/commit.env` file with the latest commit.
46+
uses: opendatahub-io/notebooks/.github/workflows/notebooks-digest-updater.yaml@main
47+
with:
48+
branch: ${{ github.event.inputs.branch }}
49+
user-hash: ${{ github.event.inputs.user_hash }}
8250

8351
# 2. Check if the Manifest PR is merged
8452
Manifests-merged:
@@ -135,9 +103,9 @@ jobs:
135103
# 3. Update the BuildConfigs for CUDA RStudio and RStudio
136104
Update-buildConfigs:
137105
if: github.event.inputs.update_buildconfigs == 'true'
138-
uses: ./.github/workflows/update-buildconfigs.yaml
106+
uses: opendatahub-io/notebooks/.github/workflows/update-buildconfigs.yaml@main
139107
with:
140-
branch: ${{ github.event.inputs.base_branch }}
108+
branch: ${{ github.event.inputs.branch }}
141109
version: ${{ github.event.inputs.buildconfigs_version }}
142110

143111
# 4. Check if the BuildConfigs PR is merged
@@ -208,7 +176,7 @@ jobs:
208176
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
209177
working-directory: ${{env.GITHUB_WORKSPACE}}
210178
run: |
211-
gh release create "$RELEASE_TAG" --title="$RELEASE_NAME-$RELEASE_TAG" --generate-notes --target $BASE_BRANCH
179+
gh release create "$RELEASE_TAG" --title="$RELEASE_NAME-$RELEASE_TAG" --generate-notes --target $BRANCH
212180
213181
# 6. Generate the release without BuildConfigs
214182
Generate-release:
@@ -225,4 +193,4 @@ jobs:
225193
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
226194
working-directory: ${{env.GITHUB_WORKSPACE}}
227195
run: |
228-
gh release create "$RELEASE_TAG" --title="$RELEASE_NAME-$RELEASE_TAG" --generate-notes --target $BASE_BRANCH
196+
gh release create "$RELEASE_TAG" --title="$RELEASE_NAME-$RELEASE_TAG" --generate-notes --target $BRANCH

.github/workflows/update-buildconfigs.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# The aim of this GitHub workflow is to update the cuda-rstudio-buildconfig.yaml and rstudio-buildconfig.yaml
2+
# If No version is provided, it will update the BuildConfigs to the next version by incrementing the minor version number by 1.
13
---
24
name: Update BuildConfigs
35
on:
@@ -21,7 +23,7 @@ on:
2123
type: string
2224
env:
2325
TMP_BRANCH: tmp-verify-${{ github.run_id }}
24-
BRANCH: ${{ inputs.branch }}
26+
BRANCH: ${{ inputs.branch || 'main' }}
2527
VERSION: ${{ inputs.version }}
2628

2729
jobs:

0 commit comments

Comments
 (0)