Skip to content

google-github-actions-bot/setup-cloud-sdk

 
 

Repository files navigation

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.

Table of contents:

Installing the client library

npm install @google-github-actions/setup-cloud-sdk

Using the client library

import * as core from '@actions/core';
import * as toolCache from '@actions/tool-cache';
import * as setupGcloud from '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.

Contributing

Contributions welcome! See the Contributing Guide.

License

Apache Version 2.0

See LICENSE

About

NPM package for interacting with Google Cloud SDK

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 94.9%
  • JavaScript 5.1%