ci: add working dir and some minor changes of create-version.sh (#2133)

* ci: add context argument in build-greptime-binary action

* refactor: add 'working-dir' in upload-artifacts action and rename 'context' to 'working-dir'

* refactor: use timestamp as part of image tag when trigger manually
This commit is contained in:
zyy17
2023-08-10 12:46:43 +08:00
committed by GitHub
parent 0270708d6d
commit 587a24e7fb
5 changed files with 27 additions and 6 deletions

View File

@@ -32,12 +32,17 @@ inputs:
description: Upload to S3
required: false
default: 'true'
working-dir:
description: Working directory to build the artifacts
required: false
default: .
runs:
using: composite
steps:
- name: Build greptime binary
shell: bash
run: |
cd ${{ inputs.working-dir }} && \
make build-greptime-by-buildx \
CARGO_PROFILE=${{ inputs.cargo-profile }} \
FEATURES=${{ inputs.features }} \
@@ -54,3 +59,4 @@ runs:
aws-secret-access-key: ${{ inputs.aws-secret-access-key }}
aws-region: ${{ inputs.aws-region }}
upload-to-s3: ${{ inputs.upload-to-s3 }}
working-dir: ${{ inputs.working-dir }}

View File

@@ -33,6 +33,10 @@ inputs:
description: Upload to S3
required: false
default: 'true'
working-dir:
description: Working directory to build the artifacts
required: false
default: .
runs:
using: composite
steps:
@@ -41,6 +45,7 @@ runs:
shell: bash
# NOTE: If the BUILD_JOBS > 4, it's always OOM in EC2 instance.
run: |
cd ${{ inputs.working-dir }} && \
make run-it-in-container BUILD_JOBS=4
- name: Upload sqlness logs
@@ -64,6 +69,7 @@ runs:
aws-secret-access-key: ${{ inputs.aws-secret-access-key }}
aws-region: ${{ inputs.aws-region }}
upload-to-s3: ${{ inputs.upload-to-s3 }}
working-dir: ${{ inputs.working-dir }}
- name: Build greptime without pyo3
if: ${{ inputs.dev-mode == 'false' }}
@@ -79,6 +85,7 @@ runs:
aws-secret-access-key: ${{ inputs.aws-secret-access-key }}
aws-region: ${{ inputs.aws-region }}
upload-to-s3: ${{ inputs.upload-to-s3 }}
working-dir: ${{ inputs.working-dir }}
- name: Build greptime on centos base image
uses: ./.github/actions/build-greptime-binary
@@ -94,3 +101,4 @@ runs:
aws-secret-access-key: ${{ inputs.aws-secret-access-key }}
aws-region: ${{ inputs.aws-region }}
upload-to-s3: ${{ inputs.upload-to-s3 }}
working-dir: ${{ inputs.working-dir }}

View File

@@ -26,10 +26,15 @@ inputs:
description: Upload to S3
required: false
default: 'true'
working-dir:
description: Working directory to upload the artifacts
required: false
default: .
runs:
using: composite
steps:
- name: Create artifacts directory
working-directory: ${{ inputs.working-dir }}
shell: bash
run: |
mkdir -p ${{ inputs.artifacts-dir }} && \
@@ -41,6 +46,7 @@ runs:
# greptime-linux-amd64-pyo3-v0.3.0
# └── greptime
- name: Compress artifacts and calculate checksum
working-directory: ${{ inputs.working-dir }}
shell: bash
run: |
tar -zcvf ${{ inputs.artifacts-dir }}.tar.gz ${{ inputs.artifacts-dir }} && \
@@ -52,13 +58,13 @@ runs:
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.artifacts-dir }}
path: ${{ inputs.artifacts-dir }}.tar.gz
path: ${{ inputs.working-dir }}/${{ inputs.artifacts-dir }}.tar.gz
- name: Upload checksum
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.artifacts-dir }}.sha256sum
path: ${{ inputs.artifacts-dir }}.sha256sum
path: ${{ inputs.working-dir }}/${{ inputs.artifacts-dir }}.sha256sum
- name: Configure AWS credentials
if: ${{ inputs.upload-to-s3 == 'true' }}
@@ -70,6 +76,7 @@ runs:
- name: Upload artifacts to S3
if: ${{ inputs.upload-to-s3 == 'true' }}
working-directory: ${{ inputs.working-dir }}
shell: bash
# The bucket layout will be:
# releases/greptimedb

View File

@@ -38,7 +38,7 @@ function create_version() {
echo "COMMIT_SHA is empty in dev build"
exit 1
fi
echo "dev-$(date "+%Y%m%d%S")-$(echo "$COMMIT_SHA" | cut -c1-8)"
echo "dev-$(date "+%Y%m%d-%s")-$(echo "$COMMIT_SHA" | cut -c1-8)"
exit 0
fi
@@ -50,7 +50,7 @@ function create_version() {
fi
echo "$GITHUB_REF_NAME"
elif [ "$GITHUB_EVENT_NAME" = workflow_dispatch ]; then
echo "$NEXT_RELEASE_VERSION-$(git rev-parse --short HEAD)-$(date "+%Y%m%d%S")"
echo "$NEXT_RELEASE_VERSION-$(git rev-parse --short HEAD)-$(date "+%Y%m%d-%s")"
elif [ "$GITHUB_EVENT_NAME" = schedule ]; then
echo "$NEXT_RELEASE_VERSION-$NIGHTLY_RELEASE_PREFIX-$(date "+%Y%m%d")"
else

View File

@@ -159,7 +159,6 @@ jobs:
path: ${{ env.CHECKOUT_GREPTIMEDB_PATH }}
- uses: ./.github/actions/build-linux-artifacts
working-directory: ${{ env.CHECKOUT_GREPTIMEDB_PATH }}
with:
arch: amd64
cargo-profile: ${{ env.CARGO_PROFILE }}
@@ -171,6 +170,7 @@ jobs:
aws-region: ${{ vars.AWS_RELEASE_BUCKET_REGION }}
dev-mode: true # Only build the standard greptime binary.
upload-to-s3: false # No need to upload to S3.
working-dir: ${{ env.CHECKOUT_GREPTIMEDB_PATH }}
build-linux-arm64-artifacts:
name: Build linux-arm64 artifacts
@@ -193,7 +193,6 @@ jobs:
path: ${{ env.CHECKOUT_GREPTIMEDB_PATH }}
- uses: ./.github/actions/build-linux-artifacts
working-directory: ${{ env.CHECKOUT_GREPTIMEDB_PATH }}
with:
arch: arm64
cargo-profile: ${{ env.CARGO_PROFILE }}
@@ -205,6 +204,7 @@ jobs:
aws-region: ${{ vars.AWS_RELEASE_BUCKET_REGION }}
dev-mode: true # Only build the standard greptime binary.
upload-to-s3: false # No need to upload to S3.
working-dir: ${{ env.CHECKOUT_GREPTIMEDB_PATH }}
release-images-to-dockerhub:
name: Build and push images to DockerHub