Fixed deploy pipeline #21
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 to Server | |
on: | |
push: | |
branches: | |
- main | |
- deploy | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '21' # Set the Node.js version | |
- name: Build Project | |
run: | | |
cd ./client | |
npm install [email protected] --save-dev # Force TypeScript to a compatible version | |
npm install | |
npm run build | |
- name: Copy files to the server | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.REMOTE_HOST }} | |
username: ${{ secrets.REMOTE_USER }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
port: 22 | |
source: "client/build/*" | |
target: "/var/www/llcode.tech/html/" | |
strip_components: 2 | |
- name: Reload Nginx | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.REMOTE_HOST }} | |
username: ${{ secrets.REMOTE_USER }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
port: 22 | |
script: "nginx -s reload" | |