Skip to content

upload

upload #51

Workflow file for this run

name: CHART-UPLOAD
on:
push:
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
- 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
cp upload-charts/*.tgz .cr-release-packages
fi
- name: Checkout helm-charts Code
uses: actions/checkout@v4
with:
repository: apecloud/helm-charts
path: helm-charts
token: ${{ env.CR_TOKEN }}
- name: Checkout block-index Code
if: inputs.PUSH_ENABLE
uses: actions/checkout@v4
with:
repository: apecloud/block-index
path: block-index
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 }}/block-index/addons|${{ github.workspace }}/helm-charts/deploy|${{ github.workspace }}/deploy" \
--access-token "${{ env.JIHULAB_ACCESS_TOKEN }}" \
--access-user "${{ env.JIHULAB_ACCESS_USER }}" \
--project-id "${{ env.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[@]}"