Skip to content

Commit

Permalink
feat: Package and publish quickstart to release (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
chyroc authored Jan 16, 2025
1 parent d29f3bf commit ae2d806
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 9 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/release.yml
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ Thumbs.db

# coze
coze_oauth_config.json
release/
go/**/assets
go/**/websites
go/**/bootstrap.sh
Expand Down
56 changes: 49 additions & 7 deletions build.sh
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!"
4 changes: 2 additions & 2 deletions shared/websites/callback.html
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,12 @@ <h3>Access Token</h3>
<span class="token-label">Access Token:</span>
<span class="token-value" id="access_token">{{access_token}}</span>
</div>
<div class="token-row refresh-token-row hidden">
<div class="token-row refresh-token-row">
<span class="token-label">Refresh Token:</span>
<span class="token-value" id="refresh_token">{{refresh_token}}</span>
</div>
<div class="token-row">
<span class="token-label">Expires In:</span>
<span class="token-label">Expire at:</span>
<span class="token-value">{{expires_in}}</span>
</div>
</div>
Expand Down

0 comments on commit ae2d806

Please sign in to comment.