Allow managing groups #34
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 App | |
on: | |
push: | |
branches: [ production ] | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Node.JS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18.X' | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Copy missing folders | |
run: | | |
cp -r ./public ./.next/standalone/ | |
cp -r ./.next/static ./.next/standalone/.next/ | |
cp -r ./prisma ./.next/standalone/ | |
- name: Zip App | |
run: (cd ./.next/standalone; zip -r ../../app.zip .) | |
# - name: Show repo files | |
# run: ls -al . | |
# - name: Show output files | |
# run: ls -al ./.next/standalone | |
- name: Upload zip App to server | |
uses: appleboy/scp-action@v0.1.7 | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.KEY }} | |
passphrase: ${{ secrets.PASSPHRASE }} | |
port: ${{ secrets.PORT }} | |
source: "./app.zip" | |
target: ${{ secrets.APP_PATH }} | |
- name: Run commands in server | |
uses: appleboy/ssh-action@v1.0.3 | |
env: | |
APP_PATH: ${{ secrets.APP_PATH }} | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.KEY }} | |
passphrase: ${{ secrets.PASSPHRASE }} | |
port: ${{ secrets.PORT }} | |
envs: APP_PATH | |
script_stop: true | |
script: | | |
cd $APP_PATH | |
unzip -o app.zip | |
npx prisma db push --skip-generate | |
pm2 restart notify-app |