Skip to content

Commit

Permalink
github actions added
Browse files Browse the repository at this point in the history
  • Loading branch information
Fokarr committed Sep 14, 2023
1 parent 1adeb8b commit 61cfb50
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
36 changes: 36 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Deploy to DigitalOcean Droplet

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '18.17'

- name: SSH and Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.DROPLET_IP_ADDRESS }}
username: ${{ secrets.DROPLET_USERNAME }}
key: ${{ secrets.DROPLET_SSH_PRIVATE_KEY }}
passphrase: ${{ secrets.SSH_KEY_PASSPHRASE }}
script: |
cd ${{ secrets.ROUTE }}
git config --global credential.helper 'store --file .git-credentials'
echo "https://${{ secrets.GIT_USERNAME }}:${{ secrets.GIT_PASSWORD }}" > .git-credentials
git pull
export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
npm run build
pm2 restart ${{ secrets.PM2_ID }}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "module",
"scripts": {
"dev": "vite build --watch & npx tailwindcss -i ./src/main.css -o ./dist/output.css --watch & nodemon app.js",
"build": "vite build",
"build": "vite build & npx tailwindcss -i ./src/main.css -o ./dist/output.css",
"start": "node app.js",
"preview": "vite preview",
"format": "prettier . --write"
Expand Down

0 comments on commit 61cfb50

Please sign in to comment.