From a2047b096cc4309f649c0d52169f38f3ac6aba63 Mon Sep 17 00:00:00 2001 From: liyang Date: Mon, 17 Feb 2025 10:57:13 +0800 Subject: [PATCH] ci: use s5cmd upload artifacts (#5550) --- .github/actions/release-cn-artifacts/action.yaml | 14 +++++++++++--- .github/scripts/upload-artifacts-to-s3.sh | 6 +++--- .github/workflows/dev-build.yml | 1 + .github/workflows/nightly-build.yml | 1 + .github/workflows/release.yml | 1 + 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/actions/release-cn-artifacts/action.yaml b/.github/actions/release-cn-artifacts/action.yaml index 062c482f68..886f79bbaf 100644 --- a/.github/actions/release-cn-artifacts/action.yaml +++ b/.github/actions/release-cn-artifacts/action.yaml @@ -51,8 +51,8 @@ inputs: required: true upload-to-s3: description: Upload to S3 - required: false - default: 'true' + required: true + default: 'false' artifacts-dir: description: Directory to store artifacts required: false @@ -77,13 +77,21 @@ runs: with: path: ${{ inputs.artifacts-dir }} + - name: Install s5cmd + shell: bash + run: | + wget https://github.com/peak/s5cmd/releases/download/v2.3.0/s5cmd_2.3.0_Linux-64bit.tar.gz + tar -xzf s5cmd_2.3.0_Linux-64bit.tar.gz + sudo mv s5cmd /usr/local/bin/ + sudo chmod +x /usr/local/bin/s5cmd + - name: Release artifacts to cn region uses: nick-invision/retry@v2 if: ${{ inputs.upload-to-s3 == 'true' }} env: AWS_ACCESS_KEY_ID: ${{ inputs.aws-cn-access-key-id }} AWS_SECRET_ACCESS_KEY: ${{ inputs.aws-cn-secret-access-key }} - AWS_DEFAULT_REGION: ${{ inputs.aws-cn-region }} + AWS_REGION: ${{ inputs.aws-cn-region }} UPDATE_VERSION_INFO: ${{ inputs.update-version-info }} with: max_attempts: ${{ inputs.upload-max-retry-times }} diff --git a/.github/scripts/upload-artifacts-to-s3.sh b/.github/scripts/upload-artifacts-to-s3.sh index 5168ba6c40..84038c200b 100755 --- a/.github/scripts/upload-artifacts-to-s3.sh +++ b/.github/scripts/upload-artifacts-to-s3.sh @@ -33,7 +33,7 @@ function upload_artifacts() { # ├── greptime-darwin-amd64-v0.2.0.sha256sum # └── greptime-darwin-amd64-v0.2.0.tar.gz find "$ARTIFACTS_DIR" -type f \( -name "*.tar.gz" -o -name "*.sha256sum" \) | while IFS= read -r file; do - aws s3 cp \ + s5cmd cp \ "$file" "s3://$AWS_S3_BUCKET/$RELEASE_DIRS/$VERSION/$(basename "$file")" done } @@ -45,7 +45,7 @@ function update_version_info() { if [[ "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then echo "Updating latest-version.txt" echo "$VERSION" > latest-version.txt - aws s3 cp \ + s5cmd cp \ latest-version.txt "s3://$AWS_S3_BUCKET/$RELEASE_DIRS/latest-version.txt" fi @@ -53,7 +53,7 @@ function update_version_info() { if [[ "$VERSION" == *"nightly"* ]]; then echo "Updating latest-nightly-version.txt" echo "$VERSION" > latest-nightly-version.txt - aws s3 cp \ + s5cmd cp \ latest-nightly-version.txt "s3://$AWS_S3_BUCKET/$RELEASE_DIRS/latest-nightly-version.txt" fi fi diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml index 25a91291be..6697e7331b 100644 --- a/.github/workflows/dev-build.yml +++ b/.github/workflows/dev-build.yml @@ -274,6 +274,7 @@ jobs: aws-cn-access-key-id: ${{ secrets.AWS_CN_ACCESS_KEY_ID }} aws-cn-secret-access-key: ${{ secrets.AWS_CN_SECRET_ACCESS_KEY }} aws-cn-region: ${{ vars.AWS_RELEASE_BUCKET_REGION }} + upload-to-s3: false dev-mode: true # Only build the standard images(exclude centos images). push-latest-tag: false # Don't push the latest tag to registry. update-version-info: false # Don't update the version info in S3. diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index 4492741521..58dde21e4c 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -240,6 +240,7 @@ jobs: aws-cn-access-key-id: ${{ secrets.AWS_CN_ACCESS_KEY_ID }} aws-cn-secret-access-key: ${{ secrets.AWS_CN_SECRET_ACCESS_KEY }} aws-cn-region: ${{ vars.AWS_RELEASE_BUCKET_REGION }} + upload-to-s3: false dev-mode: false update-version-info: false # Don't update version info in S3. push-latest-tag: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c18f692ea0..5b6c95a603 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -361,6 +361,7 @@ jobs: aws-cn-secret-access-key: ${{ secrets.AWS_CN_SECRET_ACCESS_KEY }} aws-cn-region: ${{ vars.AWS_RELEASE_BUCKET_REGION }} dev-mode: false + upload-to-s3: true update-version-info: true push-latest-tag: true