Skip to content

revert(deploy): keep VM deployment until deprecation #49

revert(deploy): keep VM deployment until deprecation

revert(deploy): keep VM deployment until deprecation #49

Workflow file for this run

name: gcloud
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
branches:
- master
env:
PROJECT_ID: ecosystem-infrastructure
GCLOUD_ZONE: us-central1-a
jobs:
build-deploy:
name: Google Cloud Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set project and image names
run: |
BRANCH_NAME=$GITHUB_REPOSITORY/$(expr $GITHUB_REF : '.*/\(.*\)') && \
BRANCH_NAME=${BRANCH_NAME,,} && \
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV && \
echo "SHORT_SHA=$(git rev-parse --short=7 $GITHUB_SHA)" >> $GITHUB_ENV
# Setup gcloud CLI
- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/[email protected]
with:
project_id: ${{ env.PROJECT_ID }}
credentials_json: '${{ secrets.GCLOUD_SA_KEY }}'
- uses: google-github-actions/[email protected]
# 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 ./docker --dir . \
--tag "gcr.io/$PROJECT_ID/$BRANCH_NAME:$SHORT_SHA"
# Deploy image to Compute Engine
- name: Deploy
run: |
gcloud compute instances create-with-container "zfnd-seeder-$SHORT_SHA" \
--zone "$GCLOUD_ZONE" \
--service-account instance-service-account@ecosystem-infrastructure.iam.gserviceaccount.com \
--scopes cloud-platform \
--machine-type n1-highcpu-4 \
--container-image "gcr.io/$PROJECT_ID/$BRANCH_NAME:$SHORT_SHA" \
--tags seeder \
--metadata-from-file startup-script=scripts/seeder-zfnd-org-startup.sh \
--container-mount-host-path mount-path=/etc/dnsseeder,host-path=/etc/dnsseeder,mode=ro