Manual Deployment #9
This file contains hidden or 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
| name: Manual Deployment | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| network_name: | |
| description: "Network to deploy (e.g., devnet-cobblet, testnet)" | |
| required: true | |
| type: string | |
| deploy_tag: | |
| description: "Ansible tag to run (e.g., full_deploy, platform_update)" | |
| required: true | |
| type: string | |
| jobs: | |
| deploy: | |
| name: Deploy Dash Network | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Fail if unauthorized user | |
| if: ${{ github.actor != 'vivekgsharma' && github.actor != 'ktechmidas' }} | |
| run: | | |
| echo "Unauthorized user: ${{ github.actor }}" | |
| exit 1 | |
| - name: Checkout dash-network-deploy | |
| uses: actions/checkout@v4 | |
| # Setup SSH key to pull private dash-network-configs repo | |
| - name: Set up GitHub SSH Key | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.EVO_APP_DEPLOY_KEY }}" > ~/.ssh/id_ed25519 | |
| chmod 600 ~/.ssh/id_ed25519 | |
| ssh-keyscan github.com >> ~/.ssh/known_hosts | |
| # Setup SSH key to connect to deployment servers | |
| - name: Set up Server SSH Key | |
| run: | | |
| echo "${{ secrets.DEPLOY_SERVER_KEY }}" > ~/.ssh/id_rsa_server | |
| chmod 600 ~/.ssh/id_rsa_server | |
| # Clone latest configs into networks/ folder | |
| - name: Clone dash-network-configs | |
| run: | | |
| rm -rf networks | |
| git clone [email protected]:dashpay/dash-network-configs.git networks | |
| # Set up Node.js | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| # Install Node.js dependencies first (required for firstRun.js) | |
| - name: Install Node.js dependencies | |
| run: | | |
| npm ci | |
| # Create initial .env file | |
| - name: Create initial .env | |
| run: | | |
| echo "NETWORK=${{ github.event.inputs.network_name }}" > .env | |
| echo "COMPOSE_PROJECT_NAME=${{ github.event.inputs.network_name }}" >> .env | |
| echo "PRESET=${{ github.event.inputs.network_name }}" >> .env | |
| echo "NODE_ENV=development" >> .env | |
| # Run firstRun.js to generate initial configuration (with env var fix) | |
| - name: Generate initial configuration | |
| run: | | |
| NETWORK=${{ github.event.inputs.network_name }} node bin/firstRun.js | |
| # Install Ansible and Python dependencies | |
| - name: Install Ansible and Dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y python3-pip python3-netaddr | |
| pip3 install ansible | |
| # Install required Ansible roles from Galaxy | |
| - name: Install Ansible Galaxy Roles | |
| run: | | |
| ansible-galaxy install -r ansible/requirements.yml | |
| # Optional: Check if inventory file exists | |
| - name: Check inventory file exists | |
| run: | | |
| if [ ! -f "networks/${{ github.event.inputs.network_name }}.inventory" ]; then | |
| echo "Inventory file not found: networks/${{ github.event.inputs.network_name }}.inventory" | |
| exit 1 | |
| fi | |
| # Run the deploy wrapper script with the selected tag and network | |
| - name: Run Deploy Script | |
| run: | | |
| chmod +x ./bin/deploy | |
| ./bin/deploy -p ${{ github.event.inputs.network_name }} --tags=${{ github.event.inputs.deploy_tag }} |