mirror of
https://github.com/google-github-actions/setup-gcloud.git
synced 2026-08-21 14:19:24 +00:00
| .. | ||
| .github | ||
| Dockerfile | ||
| README.md | ||
Google Compute Engine - GitHub Actions
An example workflow that uses GitHub Actions to deploy a container to an existing Google Compute Engine (GCE) instance.
Workflow
For pushes to the default branch, master, the workflow will:
- Verify the Google Cloud Platform credentials are correct.
- Build, tag, and push the image to Google Container Registry.
- Deploy the container image to a Google Compute Engine instance. Note that a GCE deployment requires an existing container-optimized VM.
Setup
- Create or reuse a Github repository for the example workflow:
- Create a repository.
- Move into your repository directory.
- Copy the example into the repository:
cp -r <path_to>/github-actions/example-workflows/gce/ ./
- Add your Project ID to the repository's secret, named
GCE_PROJECT. - Create a container-optimized GCE VM or use an existing container-optimized VM.
- Update
gce.ymlwith the following values:
GCE_INSTANCE: the instance name of the VM.GCE_INSTANCE_ZONE: the zone your VM resides.
Note: You can find the VM name and the zone on the Cloud Console.
Compute Instance AdminStorage Admin
Run the workflow
- Add and commit your changes:
git add .
git commit -m "Set up Github workflow"
- Push to the
masterbranch:
git push origin master
- View the workflow by selecting the
Actionstab at the top of your repository. Then click on theBuild and Deploy to GCEworkflow to see the details.