diff --git a/dch5-publish-cli.sh b/dch5-publish-cli.sh deleted file mode 100644 index ba6c9f9..0000000 --- a/dch5-publish-cli.sh +++ /dev/null @@ -1,112 +0,0 @@ -#!/bin/bash - -echo "๐Ÿš€ Starting CLI deployment process..." - -# start SSH agent and add key -echo "๐Ÿ”‘ Starting SSH agent and adding deployment key..." -eval $(ssh-agent -s) -ssh-add /c/.ssh/deepdrft_dch6_ed25519 -echo "โœ… SSH agent configured" - -CLI_PROJ="DeepDrftCli" -CLI_APP="deepdrft-cli.tar.gz" - -# Publish CLI with framework-dependent single file -echo "๐Ÿ”จ Publishing CLI project for linux-x64..." -dotnet publish $CLI_PROJ -c Release -f net9.0 -o $CLI_PROJ/publish -r linux-x64 \ - --self-contained false \ - -p:PublishSingleFile=true \ - -p:Platform="Any CPU" \ - --verbosity normal - -if [ $? -eq 0 ]; then - echo "โœ… CLI project published successfully" -else - echo "โŒ Failed to publish CLI project" - exit 1 -fi - -# Eliminate local environment from package -echo "๐Ÿงน Removing local environment from package..." -rm -rf $CLI_PROJ/publish/environment -echo "โœ… Local environment removed" - -# Compress published files -echo "๐Ÿ“ฆ Compressing published files..." -tar -czf $CLI_APP -C $CLI_PROJ/publish . -echo "โœ… Package created: $CLI_APP" - -# Deploy -REMOTE="deepdrft@dch6.snailbird.net" -CLI_APPROOT="/deepdrft/cli" - -echo "๐ŸŒ Deploying to remote server: $REMOTE" -echo "๐Ÿ“ Target directory: $CLI_APPROOT" - -echo "๐Ÿ—‘๏ธ Cleaning existing deployment..." -ssh $REMOTE "rm -rf $CLI_APPROOT/bin/*" -echo "โœ… Remote directory cleaned" - -echo "๐Ÿ“ค Uploading package to remote server..." -scp $CLI_APP $REMOTE:$CLI_APPROOT/$CLI_APP -if [ $? -eq 0 ]; then - echo "โœ… Package uploaded successfully" -else - echo "โŒ Failed to upload package" - exit 1 -fi - -echo "๐Ÿ“ฆ Extracting and setting up CLI on remote server..." -ssh $REMOTE "tar -xzf $CLI_APPROOT/$CLI_APP -C $CLI_APPROOT/bin && \ - chmod +x $CLI_APPROOT/bin/DeepDrftCli && \ - rm $CLI_APPROOT/$CLI_APP" -if [ $? -eq 0 ]; then - echo "โœ… CLI extracted and configured on remote server" -else - echo "โŒ Failed to extract CLI on remote server" - exit 1 -fi - -# Apply Local Environment (if exists) -echo "๐Ÿ”ง Checking for local environment configuration..." -if ssh $REMOTE "[ -d $CLI_APPROOT/environment ]"; then - echo "๐Ÿ“‹ Local environment found, applying configuration..." - - # Ensure environment directory exists in the binary location - ssh $REMOTE "mkdir -p $CLI_APPROOT/bin/environment" - - # Copy environment files with better error handling - if ssh $REMOTE "cp $CLI_APPROOT/environment/* $CLI_APPROOT/bin/environment/ 2>/dev/null"; then - echo "โœ… Local environment configuration applied successfully" - else - echo "โš ๏ธ Warning: Some environment files may not have been copied" - fi -else - echo "โ„น๏ธ No local environment configuration found - skipping" -fi - -echo "๐Ÿ”— Setting up user-accessible command symlink..." -# Create user-accessible symlink without sudo -ssh $REMOTE "mkdir -p ~/bin && ln -sf $CLI_APPROOT/bin/DeepDrftCli ~/bin/deepdrft" -if [ $? -eq 0 ]; then - echo "โœ… Symlink created successfully" -else - echo "โŒ Failed to create symlink" - exit 1 -fi - -echo "๐Ÿ›ฃ๏ธ Ensuring ~/bin is in PATH..." -# Ensure ~/bin is in PATH (add to .bashrc if not present) -ssh $REMOTE "grep -q '~/bin' ~/.bashrc || echo 'export PATH=\"\$HOME/bin:\$PATH\"' >> ~/.bashrc" -echo "โœ… PATH configuration updated" - -echo "๐Ÿงน Cleaning up local files..." -# Clean up -rm -rf ./$CLI_PROJ/publish -rm -f ./$CLI_APP -ssh-agent -k -echo "โœ… Local cleanup completed" - -echo "" -echo "๐ŸŽ‰ CLI deployment complete!" -echo "๐Ÿ“ Note: Run 'source ~/.bashrc' or start a new shell session to activate the deepdrft command in PATH" \ No newline at end of file