Skip to content

Deploy to naga-dev

Deploy to naga-dev #9

Workflow file for this run

---
name: Deploy to naga-dev
on:
# Manually trigger the workflow with specific inputs
workflow_dispatch:
inputs:
release_branch:
description: 'Release Branch to Deploy'
required: true
type: string
jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy Release Branch to naga-dev
steps:
- name: Validate Release Branch Input
if: github.event_name == 'workflow_dispatch'
run: |
if [ -z "${{ inputs.release_branch }}" ]; then
echo "Error: Release Branch name must be provided!"
exit 1
fi
- name: Checkout Repository
uses: actions/checkout@v6
with:
ref: ${{ inputs.release_branch || github.ref }}
fetch-depth: 0
- name: Set up SSH
uses: webfactory/ssh-agent@v0.9.1
with:
ssh-private-key: ${{ secrets.DEV_SSH_KEY }}
- name: Add Server to Known Hosts
run: |
mkdir -p ~/.ssh
ssh-keyscan "naga-dev.litgateway.com" >> ~/.ssh/known_hosts
chmod 600 ~/.ssh/known_hosts
- name: Deploy to Target Server
run: |
ssh "debian@naga-dev.litgateway.com" /bin/bash << 'EOF'
set -e
DEPLOY_BRANCH="${{ inputs.release_branch || github.ref_name }}"
echo "Starting deployment of branch: '${DEPLOY_BRANCH}' to naga-dev"
# source profile and pull changes
source .profile
cd lit-peer/rust/lit-node/lit-node
git fetch origin
git checkout "${DEPLOY_BRANCH}"
git pull origin "${DEPLOY_BRANCH}"
# Build and restart the server
./scripts/build_and_restart_no_sgx.sh
EOF
- name: Notify Deployment Status
if: always()
run: |
if [ "${{ job.status }}" = "success" ]; then
echo "Successfully deployed branch ${{ inputs.release_branch || github.ref_name }} to naga-dev."
else
echo "Error: Deployment of branch ${{ inputs.release_branch || github.ref_name }} to naga-dev failed."
exit 1
fi