github actions attempt #1
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
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "20" | |
- name: Install Dependencies | |
run: npm install | |
- name: Build | |
run: npm run build | |
- name: Prepare files | |
run: | | |
cp -r public .next/standalone | |
cp -r ./.next/static .next/standalone/.next | |
- name: Archive files | |
uses: actions/upload-artifact@v2 | |
with: | |
name: app | |
path: .next/standalone | |
deploy: | |
needs: build | |
runs-on: self-hosted | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Download files | |
uses: actions/download-artifact@v2 | |
with: | |
name: app | |
path: /home/zulmet/servers/belief/ | |
- name: Copy .env | |
run: cp /home/zulmet/servers/.env /home/zulmet/servers/belief/standalone/.env | |
- name: Move | |
run: cd /home/zulmet/servers/belief/standalone | |
- name: Update server.js | |
run: sed -i 's/3000/3002/g' server.js | |
- name: Restart server | |
run: | | |
pm2 restart server.js --name belief | |
pm2 save |