updated pipeline #36
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: ondc Deployment | |
on: | |
push: | |
branches: ['master'] | |
jobs: | |
ssh-ec2: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: SSH Setup and Cloning Repository | |
run: | | |
echo "${{ secrets.KEY }}" > ./key.pem | |
chmod 600 ./key.pem | |
mkdir -p ~/.ssh | |
ssh-keyscan ${{ secrets.HOST }} >> ~/.ssh/known_hosts | |
ssh -i ./key.pem ${{ secrets.USER }}@${{ secrets.HOST }} -T <<EOF | |
# Remove the repository directory if it exists | |
if [ -d "log-validation-utility" ]; then | |
echo "Removing existing repository folder" | |
rm -rf log-validation-utility | |
fi | |
# Clone the repository and pull the latest changes | |
echo "Cloning the repository" | |
git clone https://github.com/ONDC-Official/log-validation-utility.git | |
cd log-validation-utility | |
git pull origin master | |
EOF | |
- name: Ondc Deployment | |
run: | | |
ssh -o ServerAliveInterval=30 -o TCPKeepAlive=yes -T -i ./key.pem ${{ secrets.USER }}@${{ secrets.HOST }} <<EOF | |
ssh-keyscan ${{ secrets.HOST }} >> ~/.ssh/known_hosts | |
cd ./log-validation-utility | |
cp ~/.env ~/log-validation-utility/ | |
sudo docker-compose up -d --build | |
EOF |