-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add github workflows to release helm chart
* manual-freeze-tag.yaml to run on release branch, modify version and tags * manual-helm-cd-workflow.yaml to trigger tests * manual-release-charts.yaml to release the helm charts to public repo Signed-off-by: Dolpher Du <[email protected]>
- Loading branch information
1 parent
1d77b81
commit 1cd6ecd
Showing
3 changed files
with
116 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# Copyright (C) 2024 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
name: Manual event to release helm chart to public site on release branch | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
default: "1.1.0" | ||
description: "Release Version" | ||
required: true | ||
type: string | ||
artifacthub: | ||
default: false | ||
description: "Release to ArtifactHub repo?" | ||
required: true | ||
type: bool | ||
ghcr: | ||
default: true | ||
description: "Release to ghcr package?" | ||
required: true | ||
type: bool | ||
|
||
jobs: | ||
release-charts: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.ref }} | ||
|
||
- name: Prepare helm packages | ||
env: | ||
SRC_DIR: helm-charts | ||
DEST_DIR: charts | ||
run: | | ||
if grep -r '^version: ' `find helm-charts/ -name "Chart.yaml"` | grep -v "${{ inputs.version }}"; then | ||
echo "Version check failed" | ||
exit 1 | ||
fi | ||
git clone --branch charts-release https://github.com/opea-project/GenAIInfra.git charts | ||
# update components | ||
for chart in ${SRC_DIR}/common/* | ||
do | ||
echo "Packaging chart $chart..." | ||
helm dependency update ${chart} | ||
helm package $chart --destination ${DEST_DIR} | ||
done | ||
# update E2E Applications | ||
for chart in ${SRC_DIR}/* | ||
do | ||
if [ -f $chart ]; then continue; fi | ||
if [[ $chart =~ "common" ]]; then continue; fi | ||
echo "Packaging chart $chart..." | ||
helm dependency update ${chart} | ||
helm package $chart --destination ${DEST_DIR} | ||
done | ||
- name: Push package to helm-charts branch and ghcr repo | ||
run: | | ||
set -x | ||
cd charts | ||
if [ "${{ inputs.artifacthub }}" = "true" ]; then | ||
echo "Push ${{ inputs.version }} charts to charts-release branch" | ||
helm repo index . | ||
# Insert copyright to avoid warnings | ||
sed -i '1s/^/# Copyright (C) 2024 Intel Corporation\n# SPDX-License-Identifier: Apache-2.0\n\n/' index.yaml | ||
git config --global user.name "NeuralChatBot" | ||
git config --global user.email "[email protected]" | ||
git remote set-url origin https://NeuralChatBot:"${{ secrets.ACTION_TOKEN }}"@github.com/opea-project/GenAIInfra.git | ||
git status | ||
git add . | ||
git commit -s -m "Add release ${{ inputs.version }} helm charts" | ||
git push | ||
else | ||
echo "Skip ArtifactHub release" | ||
fi | ||
if [ "${{ inputs.ghcr }}" = "true" ]; then | ||
echo "Publish charts version ${{ inputs.version }}to ghcr" | ||
echo "${{ secrets.ACTION_TOKEN }}" | helm registry login ghcr.io -u test --password-stdin | ||
for chart in *-${{ inputs.version }}.tgz; do | ||
echo "Publishing ${chart}\n" | ||
helm push ${chart} oci://ghcr.io/opea-project/charts | ||
done | ||
else | ||
echo "Skip ghcr release" | ||
fi |