Add a manual zebrad node deploy workflow
This commit is contained in:
parent
18eb4d1c31
commit
472163f817
|
@ -0,0 +1,64 @@
|
|||
name: Deploy a zebrad node
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
network:
|
||||
default: 'mainnet'
|
||||
checkpoint_sync:
|
||||
default: true
|
||||
|
||||
env:
|
||||
PROJECT_ID: zealous-zebra
|
||||
|
||||
jobs:
|
||||
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set project and image names
|
||||
run: |
|
||||
BRANCH_NAME=$(expr $GITHUB_REF : '.*/\(.*\)') && \
|
||||
BRANCH_NAME=${BRANCH_NAME,,} && \
|
||||
REPOSITORY=${GITHUB_REPOSITORY,,} && \
|
||||
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV && \
|
||||
echo "SHORT_SHA=$(git rev-parse --short=7 $GITHUB_SHA)" >> $GITHUB_ENV && \
|
||||
echo "REPOSITORY=$REPOSITORY" >> $GITHUB_ENV
|
||||
|
||||
- name: Set up gcloud
|
||||
uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
|
||||
with:
|
||||
version: '295.0.0'
|
||||
project_id: ${{ env.PROJECT_ID }}
|
||||
service_account_key: ${{ secrets.GCLOUD_AUTH }}
|
||||
|
||||
# Build and push image to Google Container Registry
|
||||
- name: Build
|
||||
# Tagging w/ the commit SHA blocks the :latest tag on GCR
|
||||
run: |
|
||||
gcloud builds submit \
|
||||
--config cloudbuild.yaml \
|
||||
--substitutions SHORT_SHA="$SHORT_SHA",BRANCH_NAME="$BRANCH_NAME"
|
||||
|
||||
# Run once: create firewall rule to allow incoming traffic to the node
|
||||
# - name: Create Zcash incoming traffic firewall rule
|
||||
# run: |
|
||||
# gcloud compute firewall-rules create "allow-zcash" \
|
||||
# --target-tags zebrad \
|
||||
# --allow tcp:8233,tcp:18233 \
|
||||
# --source-ranges 0.0.0.0/0 \
|
||||
# --description="Allow incoming Zcash traffic from anywhere" \
|
||||
|
||||
# Creates Compute Engine virtual machine instance w/ zebrad container and disks
|
||||
- name: Create instance running zebrad container image
|
||||
run: |
|
||||
gcloud compute instances create-with-container "zebra-$BRANCH_NAME-$SHORT_SHA" \
|
||||
--container-image "gcr.io/$PROJECT_ID/$REPOSITORY/$BRANCH_NAME:$SHORT_SHA" \
|
||||
--container-mount-disk mount-path='/zebrad-cache',name=zebrad-cache-$SHORT_SHA \
|
||||
--create-disk name=zebrad-cache-$SHORT_SHA,size=100GB,type=pd-balanced,auto-delete=no \
|
||||
--machine-type n2-standard-4 \
|
||||
--service-account cos-vm@zealous-zebra.iam.gserviceaccount.com \
|
||||
--tags zebrad \
|
||||
--zone us-central1-a
|
Loading…
Reference in New Issue