-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Package and publish quickstart to release (#8)
- Loading branch information
Showing
4 changed files
with
76 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Release | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
build: | ||
name: Attach quickstart package to release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Pull the repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Build | ||
run: | | ||
./build.sh | ||
- name: Upload quickstart package to Github Release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
artifacts: release/* | ||
allowUpdates: true | ||
omitBody: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -211,6 +211,7 @@ Thumbs.db | |
|
||
# coze | ||
coze_oauth_config.json | ||
release/ | ||
go/**/assets | ||
go/**/websites | ||
go/**/bootstrap.sh | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,69 @@ | ||
#!/bin/bash | ||
|
||
# Range over all languages folders | ||
echo "Copying shared files..." | ||
set -e | ||
|
||
# 🌈 Let's make some magic happen! | ||
echo "🚀 Starting the awesome file copying process..." | ||
for lang in python go java js; do | ||
if [ ! -d "$lang" ]; then | ||
continue # skip if not exist | ||
continue # Skip non-existent directories | ||
fi | ||
|
||
for dir in "$lang"/*; do | ||
echo "Processing $dir" | ||
echo "📂 Processing directory: $dir" | ||
if [ -d "$dir" ]; then | ||
source_bootstrap_file="$lang/bootstrap.sh" | ||
if [ -f "$source_bootstrap_file" ]; then | ||
cp -f $source_bootstrap_file "$dir/bootstrap.sh" | ||
echo " Copied $source_bootstrap_file to $dir/bootstrap.sh" | ||
echo " ✨ Bootstrap file copied successfully!" | ||
fi | ||
for shared_dir in shared/*; do | ||
shared_dirname=$(basename "$shared_dir") | ||
cp -rf "$shared_dir" "$dir/" | ||
echo " Copied $shared_dir to $dir/$shared_dirname" | ||
echo " ✅ Shared resources copied: $shared_dirname" | ||
done | ||
fi | ||
done | ||
done | ||
echo "🎉 Shared files copied successfully! 🌟" | ||
echo "" | ||
|
||
echo "🚀 Creating release packages..." | ||
|
||
# Create release directory for packages | ||
rm -rf release || true | ||
mkdir -p release | ||
|
||
# Package each client directory | ||
for lang in python go java js; do | ||
if [ ! -d "$lang" ]; then | ||
continue # Skip non-existent directories | ||
fi | ||
|
||
# Process each client type directory | ||
for dir in "$lang"/*; do | ||
if [ -d "$dir" ]; then | ||
# Get directory name | ||
client_type=$(basename "$dir") | ||
# Remove -oauth suffix from directory name | ||
client_type=${client_type%-oauth} | ||
# Build final zip filename | ||
zip_name="${lang}_${client_type}.zip" | ||
|
||
echo "📦 Packaging directory $dir into $zip_name..." | ||
# Enter directory and create zip package, excluding temp files | ||
# Use find command to exclude .venv directory first, then package remaining files | ||
(cd "$dir" && find . -type d -name ".venv" -prune -o -type f -print | \ | ||
grep -v "__pycache__" | \ | ||
grep -v "\.pyc$" | \ | ||
grep -v "\.DS_Store" | \ | ||
grep -v "coze_oauth_config.json" | \ | ||
zip "../../release/$zip_name" -@) | ||
echo " ✨ Package created successfully: release/$zip_name" | ||
fi | ||
done | ||
done | ||
|
||
echo "📚 All packages have been created in the release directory!" | ||
|
||
echo "Done" | ||
echo "🎉 All done!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters