Skip to content

Commit

Permalink
ci: release greptime charts to s3
Browse files Browse the repository at this point in the history
  • Loading branch information
zyy17 committed Aug 3, 2023
1 parent 342ecd0 commit eb60232
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/scripts/release-charts-to-s3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env bash

set -ue

GREPTIME_RELEASE_BUCKET=$1
RELEASE_DIR=charts

function update_greptime_charts() {
helm repo add greptime https://greptimeteam.github.io/helm-charts/
helm repo update
}

function release_charts_to_s3() {
repo=$1
chart=$2

mkdir "$chart"
echo "Pulling chart from '$repo/$chart'..."

if [ "$repo" = "greptime" ]; then
# Add '-l devel' to pull the latest development version of greptime.
helm pull "$repo"/"$chart" -d "$chart" --devel
else
helm pull "$repo"/"$chart" -d "$chart"
fi

package=$(ls ./"$chart")

if [ -z "$package" ]; then
echo "No package found from $repo/$chart"
exit 1
fi

# Get the version from the package, for example, greptimedb-0.1.1-alpha.12.tgz -> 0.1.1-alpha.12.
version=$(echo "$package" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+[-a-zA-Z0-9.]*' | sed 's/.tgz//')

if [ -z "$version" ]; then
echo "No version found from $repo/$chart"
exit 1
fi

echo "Releasing package '$package' to 's3://$GREPTIME_RELEASE_BUCKET/$RELEASE_DIR/$chart/$version'..."

aws s3 cp "$chart"/"$package" s3://"$GREPTIME_RELEASE_BUCKET"/"$RELEASE_DIR"/"$chart"/"$version"/"$package"
aws s3 cp "$chart"/"$package" s3://"$GREPTIME_RELEASE_BUCKET"/"$RELEASE_DIR"/"$chart"/latest/"$chart"-latest.tgz
}

update_greptime_charts
release_charts_to_s3 greptime greptimedb-operator
release_charts_to_s3 greptime greptimedb
release_charts_to_s3 oci://registry-1.docker.io/bitnamicharts etcd
12 changes: 12 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,15 @@ jobs:
env:
CR_SKIP_EXISTING: true
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_CN_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_CN_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_RELEASE_BUCKET_REGION }}

- name: Release charts to S3
shell: bash
run: |
.github/scripts/release-charts-to-s3.sh ${{ vars.AWS_RELEASE_BUCKET }}

0 comments on commit eb60232

Please sign in to comment.