upload #1
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
name: CHART-UPLOAD | |
on: | |
push: | |
branches: | |
- 'main' | |
paths: | |
- 'upload-charts/*.tgz' | |
workflow_dispatch: | |
inputs: | |
CHART_PACKAGE_NAME: | |
description: "The package name of helm chart, push to apecloud-cd upload-charts dir first (e.g. pyroscope-0.2.92.tgz)" | |
required: false | |
default: '' | |
CHART_PACKAGE_URL: | |
description: "The package url of helm chart" | |
required: false | |
default: '' | |
PROJECT_ID: | |
description: "The jihulab project id to upload (e.g. kubeblocks/addons/applications)" | |
type: string | |
required: false | |
default: '' | |
run-name: upload ${{ inputs.CHART_PACKAGE_NAME }} ${{ inputs.CHART_PACKAGE_URL }} | |
env: | |
CR_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
JIHULAB_ACCESS_TOKEN: ${{ secrets.GITLAB_ACCESS_TOKEN }} | |
JIHULAB_ACCESS_USER: ${{ secrets.GITLAB_ACCESS_USER }} | |
CR_VERSION: 1.4.1 | |
jobs: | |
upload-chart: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: install cr | |
run: | | |
bash ${{ github.workspace }}/.github/utils/helm_package.sh --install-cr true | |
- name: copy helm chart | |
run: | | |
if [[ -n "${{ inputs.CHART_PACKAGE_URL }}" ]]; then | |
PACKAGE_NAME=$(echo "${{ inputs.CHART_PACKAGE_URL }}" | rev | cut -d'/' -f1 | rev) | |
curl -L -O ${{ inputs.CHART_PACKAGE_URL }} | |
mv $PACKAGE_NAME .cr-release-packages | |
elif [[ -n "${{ inputs.CHART_PACKAGE_NAME }}" ]]; then | |
cp upload-charts/${{ inputs.CHART_PACKAGE_NAME }} .cr-release-packages | |
else | |
bash ${{ github.workspace }}/.github/utils/utils.sh --type 20 | |
fi | |
- name: Checkout helm-charts Code | |
uses: actions/checkout@v4 | |
with: | |
repository: apecloud/helm-charts | |
path: helm-charts | |
token: ${{ env.CR_TOKEN }} | |
- name: Checkout kubeblocks-addons Code | |
uses: actions/checkout@v4 | |
with: | |
repository: apecloud/kubeblocks-addons | |
path: kubeblocks-addons | |
token: ${{ env.CR_TOKEN }} | |
- name: Upload Helm Charts to Jihulab | |
run: | | |
ls .cr-release-packages | |
cd .cr-release-packages | |
bash ${{ github.workspace }}/.github/utils/release_gitlab.sh \ | |
--type 3 \ | |
--asset-path ./ \ | |
--charts-dir "${{ github.workspace }}/kubeblocks-addons/addons|${{ github.workspace }}/helm-charts/charts|${{ github.workspace }}/deploy" \ | |
--access-token "${{ env.JIHULAB_ACCESS_TOKEN }}" \ | |
--access-user "${{ env.JIHULAB_ACCESS_USER }}" \ | |
--project-id "${{ inputs.PROJECT_ID }}" | |
- name: Fetch helm-charts History And Configure Git | |
run: | | |
cd helm-charts | |
git fetch --prune --unshallow | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "[email protected]" | |
- name: Upload and Index Helm Charts | |
shell: bash | |
run: | | |
cd helm-charts | |
args=(--owner "apecloud" --repo "helm-charts") | |
bash ${{ github.workspace }}/.github/utils/helm_release.sh "${args[@]}" |