diff --git a/.github/workflows/deploy-do-indexer.yml b/.github/workflows/deploy-do-indexer.yml new file mode 100644 index 00000000..3e05e03f --- /dev/null +++ b/.github/workflows/deploy-do-indexer.yml @@ -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 diff --git a/.github/workflows/deploy-do-web.yml b/.github/workflows/deploy-do-web.yml new file mode 100644 index 00000000..e5c0f51b --- /dev/null +++ b/.github/workflows/deploy-do-web.yml @@ -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