Manual Deployment #17
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_type: | |
| description: "Network type (e.g., devnet, testnet, regtest)" | |
| required: true | |
| type: string | |
| 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: Checkout dash-network-deploy | |
| uses: actions/checkout@v4 | |
| # Setup SSH keys | |
| - name: Set up SSH Keys | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.EVO_APP_DEPLOY_KEY }}" > ~/.ssh/id_ed25519 | |
| echo "${{ secrets.DEPLOY_SERVER_KEY }}" > ~/.ssh/id_rsa_server | |
| chmod 600 ~/.ssh/id_ed25519 ~/.ssh/id_rsa_server | |
| ssh-keyscan github.com >> ~/.ssh/known_hosts | |
| echo "Host *" > ~/.ssh/config | |
| echo " StrictHostKeyChecking no" >> ~/.ssh/config | |
| echo " UserKnownHostsFile=/dev/null" >> ~/.ssh/config | |
| chmod 600 ~/.ssh/config | |
| # Set up Node.js and clone configs | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| - run: npm ci | |
| - run: | | |
| rm -rf networks | |
| git clone git@github.com:dashpay/dash-network-configs.git networks | |
| # Verify network config exists | |
| - name: Check network config | |
| run: | | |
| if [ ! -f "networks/${{ github.event.inputs.network_name }}.yml" ]; then | |
| echo "Error: Network config networks/${{ github.event.inputs.network_name }}.yml not found" | |
| exit 1 | |
| fi | |
| # Create .env files | |
| - name: Create .env files | |
| run: | | |
| cat > .env << EOL | |
| NETWORK=${{ github.event.inputs.network_name }} | |
| COMPOSE_PROJECT_NAME=${{ github.event.inputs.network_name }} | |
| PRESET=${{ github.event.inputs.network_name }} | |
| NODE_ENV=development | |
| NETWORK_PATH=networks/${{ github.event.inputs.network_name }}.yml | |
| PRESETS_PATH=configs/presets | |
| COMPOSE_FILE=docker-compose.yml | |
| DRIVE_BRANCH=master | |
| DAPI_BRANCH=master | |
| DASHMATE_BRANCH=master | |
| EOL | |
| cat > networks/.env << EOL | |
| TERRAFORM_S3_BUCKET="dash-networks-deploy-state" | |
| TERRAFORM_S3_KEY="terraform/state" | |
| TERRAFORM_DYNAMODB_TABLE="dash-networks-deploy-terraform-lock" | |
| AWS_REGION="us-west-2" | |
| EOL | |
| # Install Ansible and Python dependencies | |
| - name: Install Ansible and Dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y python3-pip python3-netaddr sshpass | |
| pip3 install ansible | |
| # Install required Ansible roles from Galaxy | |
| - name: Install Ansible Galaxy Roles | |
| run: ansible-galaxy install -r ansible/requirements.yml | |
| # Run deploy | |
| - name: Run Deploy Script | |
| env: | |
| ANSIBLE_HOST_KEY_CHECKING: "False" | |
| ANSIBLE_DEPRECATION_WARNINGS: "False" | |
| ANSIBLE_PYTHON_INTERPRETER: /usr/bin/python3 | |
| NETWORK: ${{ github.event.inputs.network_name }} | |
| NETWORK_PATH: networks/${{ github.event.inputs.network_name }}.yml | |
| working-directory: /home/runner/work/dash-network-deploy/dash-network-deploy | |
| run: | | |
| chmod +x ./bin/deploy | |
| node ./bin/firstRun.js ${{ github.event.inputs.network_type }} ${{ github.event.inputs.network_name }} || exit 1 | |
| ./bin/deploy -p ${{ github.event.inputs.network_name }} --tags=${{ github.event.inputs.deploy_tag }} |