Deployment (Prod) 🚀 #7
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: Deployment (Prod) 🚀 | |
on: | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
environment: production | |
strategy: | |
matrix: | |
node-version: [18.x] | |
steps: | |
- name: 🚚 Get Latest Code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
## —— Node ———————————————————————————————————————————————— | |
- name: 🛠 Install Dependencies | |
run: npm install | |
- name: 🛠 Build Webpack Encore | |
run: npm run build:prod | |
- name: Remove not required files | |
run: | | |
rm -rf node_modules | |
## —— Deployment ———————————————————————————————————————————————— | |
- name: 🚀 Upload files via SCP | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SFTP_USERNAME }} | |
password: ${{ secrets.SFTP_PASSWORD }} | |
port: 22 | |
source: "./*" | |
target: ${{ secrets.DEPLOYMENT_PATH }} | |
clear-cache: | |
name: 🧹 Clear Cache | |
needs: deploy | |
runs-on: ubuntu-latest | |
environment: production | |
steps: | |
- name: SSH and Clear Symfony Cache | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SFTP_USERNAME }} | |
password: ${{ secrets.SFTP_PASSWORD }} | |
port: 22 | |
script: | | |
cd ${{ secrets.DEPLOYMENT_PATH }} | |
php81 `which composer` cache |