Skip to content

Commit

Permalink
Create production.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Macavity authored Jan 18, 2024
1 parent c275c86 commit 838881e
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Deployment (Prod) 🚀

on:
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest
environment: production

steps:
- name: 🚚 Get Latest Code
uses: actions/checkout@v4

## —— Node ————————————————————————————————————————————————
- name: 🛠️ Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: 🛠 Install Dependencies
run: npm install

- name: 🛠 Build NX
uses: mansagroup/nrwl-nx-action@v3
with:
targets: build

- 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.SSH_USERNAME }}
password: ${{ secrets.SSH_PASSWORD }}
port: 22
script: |
cd ${{ secrets.DEPLOYMENT_PATH }}
php81 `which composer` cache

0 comments on commit 838881e

Please sign in to comment.