Skip to content

Commit

Permalink
staging
Browse files Browse the repository at this point in the history
  • Loading branch information
Hannes Mühleisen committed Apr 30, 2024
1 parent 7afa2b6 commit 44f5cb8
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 5 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/Java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_DUCKDB_STAGING_KEY }}
run: |
cp build/release/duckdb_jdbc.jar duckdb_jdbc-linux-amd64.jar
# ./scripts/upload-assets-to-staging.sh github_release duckdb_jdbc-linux-amd64.jar
./scripts/upload-assets-to-staging.sh github_release duckdb_jdbc-linux-amd64.jar
- uses: actions/upload-artifact@v3
with:
name: java-linux-amd64
Expand Down Expand Up @@ -132,13 +132,13 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.S3_DUCKDB_STAGING_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_DUCKDB_STAGING_KEY }}
run: |
cp tools/jdbc/duckdb_jdbc.jar duckdb_jdbc-windows-amd64.jar
# ./scripts/upload-assets-to-staging.sh github_release duckdb_jdbc-windows-amd64.jar
cp build/release/duckdb_jdbc.jar duckdb_jdbc-windows-amd64.jar
./scripts/upload-assets-to-staging.sh github_release duckdb_jdbc-windows-amd64.jar
- uses: actions/upload-artifact@v3
with:
name: java-windows-amd64
path: |
tools/jdbc/duckdb_jdbc.jar
build/release/duckdb_jdbc.jar
java-osx-universal:
Expand Down Expand Up @@ -175,7 +175,7 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_DUCKDB_STAGING_KEY }}
run: |
cp build/release/duckdb_jdbc.jar duckdb_jdbc-osx-universal.jar
# ./scripts/upload-assets-to-staging.sh github_release duckdb_jdbc-osx-universal.jar
./scripts/upload-assets-to-staging.sh github_release duckdb_jdbc-osx-universal.jar
- uses: actions/upload-artifact@v3
with:
name: java-osx-universal
Expand Down
64 changes: 64 additions & 0 deletions scripts/upload-assets-to-staging.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash

# Main extension uploading script

# Usage: ./scripts/upload-staging-asset.sh <folder> <file>*
# <folder> : Folder to upload to
# <file> : File to be uploaded

if [ -z "$1" ] || [ -z "$2" ]; then
echo "Usage: ./scripts/upload-staging-asset.sh <folder> <file1> [... <fileN>]"
exit 1
fi

set -e

# skip if repo is not in duckdb organization
if [ "$GITHUB_REPOSITORY_OWNER" != "duckdb" ]; then
echo "Repository is $GITHUB_REPOSITORY_OWNER (not duckdb)"
exit 0
fi

FOLDER="$1"
DRY_RUN_PARAM=""

# dryrun if repo is not duckdb/duckdb
if [ "$GITHUB_REPOSITORY" != "duckdb/duckdb" ]; then
echo "Repository is $GITHUB_REPOSITORY (not duckdb/duckdb)"
DRY_RUN_PARAM="--dryrun"
fi
# dryrun if we are not in main
if [ "$GITHUB_REF" != "refs/heads/main" ]; then
echo "git ref is $GITHUB_REF (not refs/heads/main)"
DRY_RUN_PARAM="--dryrun"
fi

if [ "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]; then
echo "overriding DRY_RUN_PARAM, forcing upload"
DRY_RUN_PARAM=""
fi

# dryrun if AWS key is not set
if [ -z "$AWS_ACCESS_KEY_ID" ]; then
echo "No access key available"
DRY_RUN_PARAM="--dryrun"
fi


TARGET=$(git log -1 --format=%h)

if [ "$UPLOAD_ASSETS_TO_STAGING_TARGET" ]; then
TARGET="$UPLOAD_ASSETS_TO_STAGING_TARGET"
fi

# decide target for staging
if [ "$OVERRIDE_GIT_DESCRIBE" ]; then
TARGET="$TARGET/$OVERRIDE_GIT_DESCRIBE"
fi

python3 -m pip install awscli

for var in "${@: 2}"
do
aws s3 cp $var s3://duckdb-staging/$TARGET/$GITHUB_REPOSITORY/$FOLDER/ $DRY_RUN_PARAM --region us-east-2
done

0 comments on commit 44f5cb8

Please sign in to comment.