Merge pull request #5 from ThomasLdev/test/ci_steps #2
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: Instabot Deployment | |
on: | |
push: | |
branches: | |
- main | |
release: | |
types: [ published ] | |
jobs: | |
deploy: | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Rsync files to Server | |
run: | | |
rsync -avz --exclude '/vendor' --exclude '/node_modules' --exclude '/var' ./ ${{ secrets.REMOTE_USER }}@${{ secrets.REMOTE_HOST }}:${{ secrets.REMOTE_TARGET }} | |
- name: Install dependencies and compile assets on prod server | |
run: | | |
ssh -i ${{ secrets.SSH_PRIVATE_KEY }} ${{ secrets.REMOTE_USER }}@${{ secrets.REMOTE_HOST }} -p 22 << EOF | |
cd ${{ secrets.REMOTE_TARGET }} | |
composer install --no-dev --optimize-autoloader | |
php bin/console cache:clear --no-warmup --env=prod | |
php bin/console cache:warmup --env=prod | |
EOF |