Skip to content

Update main.yml

Update main.yml #6

Workflow file for this run

name: Deploy to EC2 instance
on:
push:
branches: [main]
jobs:
deployment:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4.1.7
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502
with:
aws-region: eu-north-1
aws-access-key-id: ${{ secrets.ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.SECRET_ACCESS_KEY }}
- name: Deploy and build
env:
DIR_PATH: /var/www/TalkTherapy
run:
aws ssm send-command \
--instance-ids "i-0ceef8e041cbec9af" \
--document-name "AWS-RunShellScript" \
--parameters 'commands:["cd $DIR_PATH", "git pull origin main", "sudo chown -R $USER:$USER .", "npm run build", "php composer install", "php artisan cache:clear", "sudo chown -R www-data:www-data storage", "sudo chown -R www-data:www-data bootstrap/cache", "sudo service nginx restart"]' \
--comment "Deploying application code"