Bump google-github-actions/setup-gcloud from 0 to 2 (#19) #43
Workflow file for this run
This file contains 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: gcloud | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
- update-gcloud | |
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 | |
- uses: google-github-actions/setup-gcloud@v2 | |
with: | |
version: '295.0.0' | |
project_id: ${{ env.PROJECT_ID }} | |
service_account_key: ${{ secrets.GCLOUD_SA_KEY }} | |
# 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 \ | |
--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 |