Skip to content

Commit f615bec

Browse files
committed
upload apks to greengeeks apk_repo folder
1 parent cfa0704 commit f615bec

1 file changed

Lines changed: 72 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,78 @@ jobs:
465465
466466
echo "FIREBASE_CONSOLE_URL=$FIREBASE_URL" >> $GITHUB_OUTPUT
467467
468+
- name: Set up SSH key
469+
env:
470+
SSH_HOST: ${{ vars.GREENGEEKS_SSH_HOST }}
471+
SSH_PRIVATE_KEY: ${{ secrets.GREENGEEKS_SSH_PRIVATE_KEY }}
472+
SSH_USER: ${{ vars.GREENGEEKS_SSH_USER }}
473+
run: |
474+
mkdir -p ~/.ssh
475+
if [ -z "$SSH_HOST" ]; then
476+
echo "Error: SSH_HOST variable is not set"
477+
exit 1
478+
fi
479+
# Write the SSH key, ensuring proper formatting
480+
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
481+
# Remove any trailing newlines and ensure proper key format
482+
sed -i '' -e '$ { /^$/ d; }' ~/.ssh/id_rsa 2>/dev/null || sed -i '$ { /^$/ d; }' ~/.ssh/id_rsa
483+
chmod 600 ~/.ssh/id_rsa
484+
# Verify key format
485+
if ! grep -q "BEGIN.*PRIVATE KEY" ~/.ssh/id_rsa; then
486+
echo "Error: SSH key does not appear to be in correct format"
487+
exit 1
488+
fi
489+
# Configure SSH to use only the key file and disable other auth methods
490+
cat > ~/.ssh/config <<EOF
491+
Host *
492+
IdentitiesOnly yes
493+
PreferredAuthentications publickey
494+
StrictHostKeyChecking no
495+
UserKnownHostsFile ~/.ssh/known_hosts
496+
PubkeyAuthentication yes
497+
PasswordAuthentication no
498+
ChallengeResponseAuthentication no
499+
GSSAPIAuthentication no
500+
GSSAPIKeyExchange no
501+
GSSAPIDelegateCredentials no
502+
Host $SSH_HOST
503+
User $SSH_USER
504+
IdentityFile ~/.ssh/id_rsa
505+
IdentitiesOnly yes
506+
PreferredAuthentications publickey
507+
PubkeyAuthentication yes
508+
PasswordAuthentication no
509+
ChallengeResponseAuthentication no
510+
GSSAPIAuthentication no
511+
GSSAPIKeyExchange no
512+
GSSAPIDelegateCredentials no
513+
NumberOfPasswordPrompts 0
514+
EOF
515+
chmod 600 ~/.ssh/config
516+
# Disable SSH agent completely
517+
unset SSH_AUTH_SOCK
518+
unset SSH_AGENT_PID
519+
# Remove any default SSH keys that might interfere
520+
rm -f ~/.ssh/id_ed25519 ~/.ssh/id_ecdsa ~/.ssh/id_dsa ~/.ssh/id_rsa.pub 2>/dev/null || true
521+
ssh-keyscan -H "$SSH_HOST" >> ~/.ssh/known_hosts 2>/dev/null || true
522+
523+
- name: Upload APK to server
524+
env:
525+
APK_PATH: ${{ steps.find_apk.outputs.APK_PATH }}
526+
SSH_HOST: ${{ vars.GREENGEEKS_SSH_HOST }}
527+
SSH_USER: ${{ vars.GREENGEEKS_SSH_USER }}
528+
run: |
529+
if [ -z "$APK_PATH" ]; then
530+
echo "Error: APK_PATH is not set"
531+
exit 1
532+
fi
533+
if [ ! -f "$APK_PATH" ]; then
534+
echo "Error: APK file not found at $APK_PATH"
535+
exit 1
536+
fi
537+
echo "Uploading $APK_PATH to $SSH_HOST..."
538+
scp -o StrictHostKeyChecking=no "$APK_PATH" "$SSH_USER@$SSH_HOST:tmp/apk_repo/"
539+
468540
- name: Clean up build folder after upload
469541
run: |
470542
echo "Cleaning up build folder after Firebase upload..."

0 commit comments

Comments
 (0)