Skip to content

Commit 7ee0c60

Browse files
committed
suggested adjustments
Signed-off-by: Michael Zeevi <[email protected]>
1 parent 2e1883c commit 7ee0c60

File tree

1 file changed

+10
-21
lines changed

1 file changed

+10
-21
lines changed

.github/workflows/ci.yaml

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -91,21 +91,9 @@ jobs:
9191
- uses: actions/checkout@v4
9292
with:
9393
token: ${{ secrets.GH_TOKEN_NVIDIA_CI_CD }} # token must be explicitly set here for push to work in following step
94-
- name: Set is_push flag
95-
id: set-is-push
94+
- name: Determine version, tag, and base branch
9695
run: |
97-
if [[ "${{ github.event_name }}" == "push" && "${{ github.ref_type }}" == "tag" ]]; then
98-
echo "is_push=false" >> $GITHUB_ENV
99-
else
100-
echo "is_push=true" >> $GITHUB_ENV
101-
fi
102-
- name: Determine version, tag, and base branch - Process based on is_push flag
103-
run: |
104-
if [[ "$is_push" == "true" ]]; then
105-
echo "Setting VERSION_WITH_PREFIX to git commit hash."
106-
VERSION_WITH_PREFIX=$(git rev-parse --short HEAD)
107-
echo VERSION_WITH_PREFIX=$VERSION_WITH_PREFIX >> $GITHUB_ENV
108-
else
96+
if [[ "${{ github.ref_type }}" == "tag" ]]; then
10997
git_tag=${{ github.ref_name }}
11098
echo VERSION_WITH_PREFIX=$git_tag >> $GITHUB_ENV
11199
echo VERSION_WITHOUT_PREFIX=${git_tag:1} >> $GITHUB_ENV # without the 'v' prefix
@@ -116,6 +104,8 @@ jobs:
116104
base_branch=$v_major_minor.x
117105
fi
118106
echo BASE_BRANCH=$base_branch >> $GITHUB_ENV
107+
elif [[ "${{ github.ref_type }}" == "branch" && "${{ github.event_name }}" == "push" ]]; then
108+
echo VERSION_WITH_PREFIX=$(git rev-parse --short HEAD) >> $GITHUB_ENV
119109
fi
120110
- uses: docker/login-action@v3
121111
with:
@@ -139,23 +129,22 @@ jobs:
139129
BUNDLE_IMG: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-bundle:${{ env.VERSION_WITH_PREFIX }}
140130
NGC_CLI_API_KEY: ${{ secrets.NVCR_TOKEN }}
141131
run: |
142-
if [[ "$is_push" == "false" ]]; then
143-
export VERSION=${{ env.VERSION_WITHOUT_PREFIX }}
132+
if [[ "${{ github.ref_type }}" == "tag" ]]; then
144133
version_major_minor=$(echo $VERSION_WITH_PREFIX | grep -Eo 'v[0-9]+\.[0-9]+')
145134
export CHANNELS=stable,$version_major_minor
146135
export DEFAULT_CHANNEL=$version_major_minor
147-
else
148-
export DEFAULT_CHANNEL=v1.1 # hard coded
149-
export CHANNELS=stable,v1.1 # hard coded
136+
export VERSION=${{ env.VERSION_WITHOUT_PREFIX }}
137+
elif [[ "${{ github.ref_type }}" == "branch" && "${{ github.event_name }}" == "push" ]]; then
138+
export CHANNELS=stable,v1.1 # hard coded
139+
export DEFAULT_CHANNEL=v1.1 # hard coded
150140
export VERSION=1.1.0-${{ env.VERSION_WITH_PREFIX }} # using the commit hash
151141
export NETWORK_OPERATOR_VERSION=${{ env.VERSION_WITH_PREFIX }} # for push use commit sha
152142
fi
153143
make bundle bundle-build bundle-push
154-
if [[ "$is_push" == "true" ]]; then
144+
if [[ "${{ github.ref_type }}" == "branch" && "${{ github.event_name }}" == "push" ]]; then
155145
export BUNDLE_IMG=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-bundle:latest # hard coded
156146
make bundle-build bundle-push
157147
fi
158-
159148
- name: Create PR with bundle to Network Operator
160149
if: github.ref_type == 'tag'
161150
env:

0 commit comments

Comments
 (0)