feat(versioning): split application and protocol versioning (#505) #4
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: Deploy GCP Testnet Bootnodes | |
on: | |
push: | |
tags: | |
- 'v*' # This will match any tag that starts with 'v' | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
build-and-release: | |
runs-on: ubuntu-latest | |
environment: | |
name: "test" #will expand to other envs later, currently "test" deploys to the 5 GCP bootnodes | |
outputs: | |
environment: ${{ steps.set-env.outputs.environment }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: Set Version | |
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- name: Build Binary | |
run: | | |
make build | |
- id: auth | |
uses: google-github-actions/auth@v2 | |
with: | |
workload_identity_provider: projects/784882329213/locations/global/workloadIdentityPools/github-oidc-pool/providers/github-oidc-provider | |
service_account: [email protected] | |
- name: Install Google Cloud SDK | |
uses: google-github-actions/setup-gcloud@v2 | |
with: | |
version: 'latest' | |
project_id: ${{ vars.GCP_PROJECT_ID }} | |
- name: Upload Binary and config for contracts npm modules to GCP | |
run: | | |
BINARY_NAME=${GITHUB_REF#refs/tags/} | |
gsutil cp ./bin/masa-node gs://${{ vars.GCP_BUCKET_NAME }}/$BINARY_NAME/masa-node | |
gsutil cp ./bin/masa-node gs://${{ vars.GCP_BUCKET_NAME }}/masa-node | |
gsutil cp ./contracts/* gs://${{ vars.GCP_BUCKET_NAME }}/$BINARY_NAME/ | |
gsutil cp ./contracts/* gs://${{ vars.GCP_BUCKET_NAME }}/ | |
deploy: | |
needs: build-and-release | |
runs-on: ubuntu-latest | |
environment: | |
name: test | |
steps: | |
- id: auth | |
uses: google-github-actions/auth@v2 | |
with: | |
workload_identity_provider: projects/784882329213/locations/global/workloadIdentityPools/github-oidc-pool/providers/github-oidc-provider | |
service_account: [email protected] | |
- name: Update Instance Metadata | |
run: | | |
ENVIRONMENT="test" | |
echo "Looking for instances with env metadata: $ENVIRONMENT" | |
INSTANCES=$(gcloud compute instances list --filter="metadata.items.ENV=$ENVIRONMENT" --format="get(name)") | |
echo "Found instances: $INSTANCES" | |
for INSTANCE in $INSTANCES; do | |
ZONE=$(gcloud compute instances list --filter="name=($INSTANCE)" --format="get(zone)" --limit=1) | |
echo "Updating instance: $INSTANCE in zone: $ZONE" | |
gcloud compute instances add-metadata $INSTANCE --metadata masa-oracle-redeploy=${GITHUB_REF#refs/tags/} --zone=$(echo $ZONE | tr -d '\n') | |
done |