https://github.com/google-github-actions/setup-cloud-sdk
An NPM package for installing and configuring the Google Cloud SDK in GitHub Actions.
https://github.com/google-github-actions/setup-cloud-sdk
actions gcloud gcp github-actions google-cloud google-cloud-platform npm
Last synced: 9 months ago
JSON representation
An NPM package for installing and configuring the Google Cloud SDK in GitHub Actions.
- Host: GitHub
- URL: https://github.com/google-github-actions/setup-cloud-sdk
- Owner: google-github-actions
- License: apache-2.0
- Created: 2021-06-03T15:59:44.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-04-17T02:02:28.000Z (9 months ago)
- Last Synced: 2025-04-17T15:51:52.207Z (9 months ago)
- Topics: actions, gcloud, gcp, github-actions, google-cloud, google-cloud-platform, npm
- Language: TypeScript
- Homepage: https://cloud.google.com/sdk/docs
- Size: 3.51 MB
- Stars: 10
- Watchers: 3
- Forks: 15
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# [Google GitHub actions: Setup Cloud SDK Client](https://github.com/google-github-actions)
Setup Cloud SDK for GitHub Actions API client for Node.js
A comprehensive list of changes in each version may be found in
[the CHANGELOG](https://github.com/google-github-actions/setup-cloud-sdk/blob/main/CHANGELOG.md).
* [Client API Reference](./docs/modules.md)
**Table of contents:**
* [Installing the client library](#installing-the-client-library)
* [Using the client library](#using-the-client-library)
* [Versioning](#versioning)
* [Contributing](#contributing)
* [License](#license)
**This is not an officially supported Google product, and it is not covered by a
Google Cloud support contract. To report bugs or request features in a Google
Cloud product, please contact [Google Cloud
support](https://cloud.google.com/support).**
### Installing the client library
```bash
npm install @google-github-actions/setup-cloud-sdk
```
### Using the client library
```TS
import * as core from '@actions/core';
import * as toolCache from '@actions/tool-cache';
import * as setupGcloud from '@google-github-actions/setup-cloud-sdk';
// Install gcloud if not already installed.
const gcloudVersion = await setupGcloud.getLatestGcloudSDKVersion();
if (!setupGcloud.isInstalled(gcloudVersion)) {
await setupGcloud.installGcloudSDK(gcloudVersion);
} else {
const toolPath = toolCache.find('gcloud', gcloudVersion);
core.addPath(path.join(toolPath, 'bin'));
}
// Authenticate gcloud SDK.
if (credentials) await setupGcloud.authenticateGcloudSDK(credentials);
const authenticated = await setupGcloud.isAuthenticated();
if (!authenticated) {
throw new Error('Error authenticating the Cloud SDK.');
}
const toolCommand = setupGcloud.getToolCommand();
```
## Versioning
This library follows [Semantic Versioning](http://semver.org/).
## Contributing
Contributions welcome! See the [Contributing Guide](./CONTRIBUTING.md).
## License
Apache Version 2.0
See [LICENSE](./LICENSE)