Skip to content

Commit

Permalink
feat: implemented deployment workflows for digital ocean (#629)
Browse files Browse the repository at this point in the history
  • Loading branch information
hussedev committed Aug 6, 2024
1 parent 8dc4bcc commit c44acb6
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/deploy-do-indexer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Deploy DO Indexer

on:
push:
branches:
- main
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm ci
- name: Test build
run: npm run build
deploy-indexer:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy to production
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.DO_INDEXER_IP }}
username: ${{ secrets.DO_USER }}
key: ${{ secrets.DO_SSH_KEY }}
script: |
export N_PREFIX="$HOME/n"; [[ :$PATH: == *":$N_PREFIX/bin:"* ]] || PATH+=":$N_PREFIX/bin"
cd grants-stack-indexer
git fetch origin main
git reset --hard origin/main
npm install && npm run build
pm2 reload indexer
34 changes: 34 additions & 0 deletions .github/workflows/deploy-do-web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Deploy DO Web

on: workflow_dispatch

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm ci
- name: Test build
run: npm run build
deploy-indexer:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy to production
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.DO_WEB_IP }}
username: ${{ secrets.DO_USER }}
key: ${{ secrets.DO_SSH_KEY }}
script: |
export N_PREFIX="$HOME/n"; [[ :$PATH: == *":$N_PREFIX/bin:"* ]] || PATH+=":$N_PREFIX/bin"
cd grants-stack-indexer
git fetch origin main
git reset --hard origin/main
npm install && npm run build
pm2 reload web

0 comments on commit c44acb6

Please sign in to comment.