Skip to content

Commit 744ed29

Browse files
committed
CLOUDP-295785 - move away from GHA variables
1 parent 6b4107d commit 744ed29

File tree

5 files changed

+54
-5
lines changed

5 files changed

+54
-5
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: 'Switch context'
2+
inputs:
3+
context-name:
4+
description: 'Context name to switch to'
5+
required: true
6+
outputs:
7+
python-version:
8+
description: 'Python version'
9+
value: string
10+
initial-commit-sha:
11+
description: 'Initial commit sha for calculating changelog diffs'
12+
value: string
13+
initial-version:
14+
description: 'Initial version to release if no tag exists yet'
15+
value: string
16+
runs:
17+
using: "composite"
18+
steps:
19+
- name: Switch context
20+
shell: bash
21+
run: |
22+
echo "Initializing context files"
23+
cp scripts/dev/contexts/gha-private-context scripts/dev/contexts/private-context
24+
scripts/dev/switch_context.sh ${{inputs.context-name}}
25+
echo "Finished initializing to the ${{inputs.context-name}}"
26+
echo "python-version=$(echo $PYTHON_VERSION)" >> $GITHUB_OUTPUT
27+
echo "initial-commit-sha=$(echo $INITIAL_COMMIT_SHA)" >> $GITHUB_OUTPUT
28+
echo "initial-version=$(echo $INITIAL_VERSION)" >> $GITHUB_OUTPUT

.github/workflows/preview_release_notes.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,22 @@ jobs:
2121
uses: actions/checkout@v4
2222
with:
2323
fetch-depth: '0'
24+
- name: Switch to root context
25+
id: switch_context
26+
uses: ./.github/actions/switch-context
27+
with:
28+
context-name: 'root-context'
2429
- name: Setup host
2530
uses: ./.github/actions/setup-ubuntu-host
2631
with:
27-
python-version: '${{ vars.PYTHON_VERSION }}'
32+
python-version: '${{ steps.switch_context.outputs.python-version }}'
2833
- name: Generate Release Notes
29-
id: generate_release_notes
3034
run: python -m scripts.release.release_notes -s $INITIAL_COMMIT_SHA -v $INITIAL_VERSION -o release_notes_tmp.md
3135
env:
3236
# We can not use environments set via GitHub UI because they will
3337
# not be available in the pull requests running from forks.
34-
INITIAL_COMMIT_SHA: 9ed5f98fc70c5b3442f633d2393265fb8a2aba0c
35-
INITIAL_VERSION: 1.3.0
38+
INITIAL_COMMIT_SHA: '${{ steps.switch_context.outputs.initial-commit-sha }}'
39+
INITIAL_VERSION: '${{ steps.switch_context.outputs.initial-version}}'
3640
- name: Add disclaimer to release notes preview
3741
run: |
3842
echo -e "_:warning: (this preview might not be accurate if the PR is not rebased on current master branch)_\n" > release_notes_preview.md

.github/workflows/require_changelog.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,15 @@ jobs:
2222
uses: actions/checkout@v4
2323
with:
2424
fetch-depth: '0'
25+
- name: Switch to root context
26+
id: switch_context
27+
uses: ./.github/actions/switch-context
28+
with:
29+
context-name: 'root-context'
2530
- name: Setup host
2631
uses: ./.github/actions/setup-ubuntu-host
2732
with:
28-
python-version: '${{ vars.PYTHON_VERSION }}'
33+
python-version: '${{ steps.switch_context.outputs.python-version }}'
2934
- name: Check if changelog entry file was added in this PR
3035
run: |
3136
set -o pipefail
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
set -Eeou pipefail
4+
5+
export NAMESPACE=""
6+
export CLUSTER_NAME=""
7+
export LOCAL_OPERATOR="false"
8+
export BASE_REPO_URL=""

scripts/dev/contexts/root-context

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,7 @@ fi
129129
# but we can unify once we are done with unified operator
130130
# installation for both multicluster and single cluster setups.
131131
export OPERATOR_NAME="mongodb-kubernetes-operator"
132+
133+
# Variables used for release process
134+
export INITIAL_COMMIT_SHA="9ed5f98fc70c5b3442f633d2393265fb8a2aba0c"
135+
export INITIAL_VERSION="1.3.0"

0 commit comments

Comments
 (0)