mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-06 05:12:54 +00:00
83 lines
3.0 KiB
YAML
83 lines
3.0 KiB
YAML
name: Upload artifacts
|
|
description: Upload artifacts
|
|
inputs:
|
|
artifacts-dir:
|
|
description: Directory to store artifacts
|
|
required: true
|
|
target-file:
|
|
description: The path of the target artifact
|
|
required: true
|
|
version:
|
|
description: Version of the artifact
|
|
required: true
|
|
release-to-s3-bucket:
|
|
description: S3 bucket to store released artifacts
|
|
required: true
|
|
aws-access-key-id:
|
|
description: AWS access key id
|
|
required: true
|
|
aws-secret-access-key:
|
|
description: AWS secret access key
|
|
required: true
|
|
aws-region:
|
|
description: AWS region
|
|
required: true
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Create artifacts directory
|
|
shell: bash
|
|
run: |
|
|
mkdir -p ${{ inputs.artifacts-dir }} && \
|
|
mv ${{ inputs.target-file }} ${{ inputs.artifacts-dir }}
|
|
|
|
# The compressed artifacts will use the following layout:
|
|
# greptime-linux-amd64-pyo3-v0.3.0sha256sum
|
|
# greptime-linux-amd64-pyo3-v0.3.0.tar.gz
|
|
# greptime-linux-amd64-pyo3-v0.3.0
|
|
# └── greptime
|
|
- name: Compress artifacts and calculate checksum
|
|
shell: bash
|
|
run: |
|
|
tar -zcvf ${{ inputs.artifacts-dir }}.tar.gz ${{ inputs.artifacts-dir }} && \
|
|
echo $(shasum -a 256 ${{ inputs.artifacts-dir }}.tar.gz | cut -f1 -d' ') > ${{ inputs.artifacts-dir }}.sha256sum
|
|
|
|
# Note: The artifacts will be double zip compressed(related issue: https://github.com/actions/upload-artifact/issues/39).
|
|
# However, when we use 'actions/download-artifact@v3' to download the artifacts, it will be automatically unzipped.
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ${{ inputs.artifacts-dir }}
|
|
path: ${{ inputs.artifacts-dir }}.tar.gz
|
|
|
|
- name: Upload checksum
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ${{ inputs.artifacts-dir }}.sha256sum
|
|
path: ${{ inputs.artifacts-dir }}.sha256sum
|
|
|
|
- name: Configure AWS credentials
|
|
uses: aws-actions/configure-aws-credentials@v2
|
|
with:
|
|
aws-access-key-id: ${{ inputs.aws-access-key-id }}
|
|
aws-secret-access-key: ${{ inputs.aws-secret-access-key }}
|
|
aws-region: ${{ inputs.aws-region }}
|
|
|
|
- name: Upload artifacts to S3
|
|
shell: bash
|
|
# The bucket layout will be:
|
|
# releases/greptimedb
|
|
# ├── v0.1.0
|
|
# │ ├── greptime-darwin-amd64-pyo3-v0.1.0.sha256sum
|
|
# │ └── greptime-darwin-amd64-pyo3-v0.1.0.tar.gz
|
|
# └── v0.2.0
|
|
# ├── greptime-darwin-amd64-pyo3-v0.2.0.sha256sum
|
|
# └── greptime-darwin-amd64-pyo3-v0.2.0.tar.gz
|
|
run: |
|
|
aws s3 cp \
|
|
${{ inputs.artifacts-dir }}.tar.gz \
|
|
s3://${{ inputs.release-to-s3-bucket }}/releases/greptimedb/${{ inputs.version }}/${{ inputs.artifacts-dir }}.tar.gz && \
|
|
aws s3 cp \
|
|
${{ inputs.artifacts-dir }}.sha256sum \
|
|
s3://${{ inputs.release-to-s3-bucket }}/releases/greptimedb/${{ inputs.version }}/${{ inputs.artifacts-dir }}.sha256sum
|