I have a VM instance on GCloud that manages both dev/prod. Currently, I manage deploying by just SSH'ing into the instance, cd'ing into dev/prod, and manually checking out or pulling the new changes.
Trying to automate this process, I can't find any documentation on how to do this with GitHub Actions. It seems like it's expecting me to have two separate instances created for Dev/Prod and then run gcloud deploy on it, but hoping there is a simpler way. I can connect to gcloud and run commands, just don't see a way to cd in a specific directory and checkout the relevant branch. Seems like there is an SSH option, but it doesn't seem like it's for this. Any advice would be helpful.
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@master
with:
project_id: ${{ secrets.PROJECT_ID }}
service_account_key: ${{ secrets.SA_KEY }}
export_default_credentials: true
- name: Update dev branch
run: |
gcloud config set project test-project
gcloud help -- SEARCH_TERMS
I ended up using appleboy for this with a great deal of success:
https://github.com/appleboy/ssh-action
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With