Update main.yml #4
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
name: Deploy | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: CI/CD # Specify the environment where the variables are set | |
steps: | |
- name: Print User, Host, and Port Information | |
run: | | |
echo "Username: ${{ vars.USER }}" | |
echo "Host: ${{ vars.HOST }}" | |
echo "Port: ${{ vars.PORT }}" | |
- name: Setup SSH Key | |
run: | | |
echo "${{ vars.SSHKEY }}" > ~/.ssh/temp_private_key | |
chmod 600 ~/.ssh/temp_private_key | |
- name: Debug SSH Connection | |
run: | | |
ssh -vvv -o StrictHostKeyChecking=no -i ~/.ssh/temp_private_key -p ${{ vars.SSH_PORT }} ${{ vars.SSH_USERNAME }}@${{ vars.SSH_HOST }} echo "SSH connection successful" | |
- name: Execute remote deployment script | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ vars.HOST }} | |
username: ${{ vars.USER}} | |
port: ${{ vars.PORT }} | |
key: ${{ vars.SSHKEY }} | |
script: | | |
sudo chmod +x /root/soda-admin/CD.sh | |
sudo chmod +x /root/soda-admin/deploy.sh | |
ls -l /root/soda-admin/ | |
pwd | |
echo "Executing CD.sh" | |
sudo /root/soda-admin/CD.sh |