Skip to content

Commit

Permalink
appleboy attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
emrergin committed Jan 1, 2024
1 parent 9a14367 commit 7b2bdae
Showing 1 changed file with 55 additions and 41 deletions.
96 changes: 55 additions & 41 deletions .github/workflows/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,59 @@ name: CI and Deployment
on: [push]

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: Generate date and write to file
run: echo "const buildDate = '`date +%Y%m%d%H%M`'; export default buildDate;" > buildDate.ts
- name: Build
run: npm run buildfordeploy
- 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
# build:
# runs-on: ubuntu-latest
# env:
# NEXT_TELEMETRY_DISABLED: 1
# 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: Generate date and write to file
# run: echo "const buildDate = '`date +%Y%m%d%H%M`'; export default buildDate;" > buildDate.ts
# - name: Build
# run: npm run buildfordeploy
# - 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/standalone
- name: Copy .env
run: cp /home/zulmet/servers/.env /home/zulmet/servers/belief/standalone/.env
- name: Update server.js
run: sed -i 's/3000/3002/g' /home/zulmet/servers/belief/standalone/server.js
- name: Restart server
run: |
pm2 restart /home/zulmet/servers/belief/standalone/server.js --name belief
pm2 save
# deploy:
# needs: build
# runs-on: self-hosted
# env:
# NEXT_TELEMETRY_DISABLED: 1
# steps:
# - uses: actions/checkout@v2
# - name: Download files
# uses: actions/download-artifact@v2
# with:
# name: app
# path: /home/zulmet/servers/belief/standalone
# - name: Copy .env
# run: cp /home/zulmet/servers/.env /home/zulmet/servers/belief/standalone/.env
# - name: Update server.js
# run: sed -i 's/3000/3002/g' /home/zulmet/servers/belief/standalone/server.js
# - name: Restart server
# run: |
# pm2 restart /home/zulmet/servers/belief/standalone/server.js --name belief
# pm2 save

test:
- name: executing remote ssh commands using ssh key
uses: appleboy/ssh-action@v1.0.2
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
script: whoami

0 comments on commit 7b2bdae

Please sign in to comment.