[CI/CD] git clone to deploy script #22
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: Simple Deploy | |
on: | |
push: | |
branches: | |
- main # run the Action on push events to the main branch. | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v2 | |
- name: Deploy to VPS | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SERVER_IP }} | |
username: ${{ secrets.SERVER_USER }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
envs: TELEGRAM_TOKEN | |
script: | | |
if [ -d $HOME/BotFishingGame ]; then | |
cd ~/BotFishingGame | |
git pull origin main | |
else | |
git clone https://github.com/Flagro/BotFishingGame.git ~/BotFishingGame | |
cd ~/BotFishingGame | |
fi | |
git pull origin main | |
cp .env-example .env | |
echo "TELEGRAM_TOKEN=${{ secrets.TELEGRAM_TOKEN }}" >> .env | |
sudo ../limited-docker-compose.sh up -d --build |