Deploy #12
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: workflow_dispatch | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Validate composer.json and composer.lock | |
run: composer validate --strict | |
- name: Cache Composer packages | |
id: composer-cache | |
uses: actions/cache@v4 | |
with: | |
path: vendor | |
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-php- | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.3' | |
- name: Install dependencies | |
run: composer install --prefer-dist --no-progress | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifact | |
path: | | |
vendor | |
src | |
templates | |
translations | |
assets | |
config | |
migrations | |
public | |
- name: download artifact to server | |
uses: actions/download-artifact@v4 | |
with: | |
name: artifact | |
path: tmp | |
- name: rsync deployments | |
uses: burnett01/rsync-deployments@6.0.0 | |
with: | |
switches: -avzr --delete | |
path: tmp | |
remote_path: /home/${{ secrets.USERNAME }}/tmp/ | |
remote_host: ${{ secrets.HOST }} | |
remote_user: ${{ secrets.USERNAME }} | |
remote_key: ${{ secrets.KEY }} | |
- name: remove folder | |
uses: appleboy/ssh-action@v1.0.3 | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.KEY }} | |
port: ${{ secrets.PORT }} | |
script: | | |
rm -rf /var/www/virtual/band/band-api/vendor | |
rm -rf /var/www/virtual/band/band-api/src | |
rm -rf /var/www/virtual/band/band-api/templates | |
rm -rf /var/www/virtual/band/band-api/translation | |
rm -rf /var/www/virtual/band/band-api/assets | |
rm -rf /var/www/virtual/band/band-api/config | |
rm -rf /var/www/virtual/band/band-api/migrations | |
rm -rf /var/www/virtual/band/band-api/public/bundles | |
- name: remove folder | |
uses: appleboy/ssh-action@v1.0.3 | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.KEY }} | |
port: ${{ secrets.PORT }} | |
script: | | |
mv /home/band/tmp/tmp/vendor /var/www/virtual/band/band-api | |
mv /home/band/tmp/tmp/src /var/www/virtual/band/band-api | |
mv /home/band/tmp/tmp/templates /var/www/virtual/band/band-api | |
mv /home/band/tmp/tmp/translation /var/www/virtual/band/band-api | |
mv /home/band/tmp/tmp/assets /var/www/virtual/band/band-api | |
mv /home/band/tmp/tmp/config /var/www/virtual/band/band-api | |
mv /home/band/tmp/tmp/migrations /var/www/virtual/band/band-api | |
mv /home/band/tmp/tmp/public/bundles /var/www/virtual/band/band-api/public | |
- name: remove folder | |
uses: appleboy/ssh-action@v1.0.3 | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.KEY }} | |
port: ${{ secrets.PORT }} | |
script: | | |
rm -rf /home/band/tmp/tmp |