GithubHelp home page GithubHelp logo

mathieu-bour / setup-gcloud Goto Github PK

View Code? Open in Web Editor NEW
13.0 1.0 2.0 33.14 MB

Install the Google Cloud SDK in your GitHub Actions workflow.

Home Page: https://github.com/marketplace/actions/setup-google-cloud-sdk

License: MIT License

JavaScript 9.70% TypeScript 90.30%
github-actions actions google-cloud-sdk gcloud google-cloud

setup-gcloud's Introduction

mathieu-bour/setup-gcloud

License Stars Latest release Workflow status

Install the Google Cloud SDK in your GitHub Actions workflow.

This action is not supported by Google Cloud.

Proudly maintained by Mathieu Bour, former Vice-CTO @mathrix-education.

Announcements

2020/11/20: The GoogleCloudPlatform official GitHub organization has deprecated the setup-gcloud action. @google-github-actions/setup-gcloud should be used instead for comparison.

2019/01/27: The GoogleCloudPlatform official GitHub organization has released an official setup-gcloud action. Compared to Edutech's one, we provide some additional automation tasks, such as project id discovery and automatic Docker Configuration.

Acknowledgements

This action was initially developed for Education Media SA. The repository is now maintained by @mathieu-bour.

Motivations

Since the advent of GitHub Actions, Edutech Media SA has chosen to migrate from Google Cloud Build to this new compilation system.

If the official @actions/gcloud action works perfectly, the fact that it is in two parts (auth and cli) and that it is based on Docker makes it slow and not very suitable for launching multiple commands.

So we chose to create a JavaScript action to fix this problem, also adding additional features, such as Docker authentication with Google Cloud Container Registry.

Usage

Supported operating systems

This action currently supports Ubuntu, Mac-OS and Windows based systems. The supported operating system matrix is the following:

Operating system Status
ubuntu-16.04 supported
ubuntu-18.04 (ubuntu-latest) supported
ubuntu-20.04 supported
macos-10.15 (macos-latest) supported
windows-2019 (windows-latest) supported

Inputs

Name Type Default value
version 'latest' / local / string 'latest'
service-account-key string (base64) ''
project 'auto' / 'none' / string 'auto'
components string ''
configure-docker 'true' / 'false' / string 'false'

version

If you need a precise version of the Google Cloud SDK, you may provide this input. By default, the latest version of the Google Cloud SDK will be downloaded. We strongly advise you to do so since using the latest version may break your workflow if Google release a breaking version. If you prefer using the pre-installed Google Cloud SDK (ubuntu only), you may use local.

service-account-key

To authenticate the SDK, you may provide a base64-encoded service account JSON key. In order to secure you workflow, use GitHub Actions secrets.

project

By default, if you provide a service-account-key, the action will use it to determine which is the default project.

  • If you want to specify a different project (for example, in case of cross-project interaction), you may explicitly specify your project ID here.
  • If you want to disable the project configuration and provide your project ID later in your workflow, set this input to 'none'.

components

If you want to install additional SDK components (for example: beta or gsutil), you may provide them in this input as a comma-separated list.

configure-docker

If you want to push an image to the Google Container Registry, you may authenticate the Docker agent. Use 'true' to authenticate against all the *.gcr.io registries, or comma-separated Artifacts Registries.

Examples

See action.yml for details.

Minimum configuration

- uses: mathieu-bour/setup-gcloud@main  # WARNING: se the latest stable version instead!

By default, the minimal example will install the latest Google Cloud SDK. Because no service account key was provided you will have to authenticate the SDK yourself (for example, with gcloud auth activate-service-account).

Typical CI configuration

- name: Setup Google Cloud SDK
  uses: mathieu-bour/[email protected]
  with:
    service-account-key: ${{ secrets.GCLOUD_AUTH }} # base64-encoded service account JSON key
    confgure-docker: true

In this example, you provide a service account key. The action automatically download the latest version of the SDK and authenticates using your key.

Then using the field "project_id" of your key, we will set the default project using gcloud config set project {project}, so you do not have to do it later.

Finally, because you may want to build a Docker image and upload it to the Google Container Registry, the action will configure Docker to allow the upload of your image. Make sure the service account has the correct rights to write on the bucket linked to the registry.

setup-gcloud's People

Contributors

dependabot[bot] avatar mathieu-bour avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

ozkancan-pvpn

setup-gcloud's Issues

Error: The `add-path` command is disabled.

GitHub deprecated set-env and add-path commands.

From today on, build started getting broken with the following errors:

Error: Unable to process command '::add-path::/usr/lib/google-cloud-sdk/bin' successfully.
Error: The add-path command is disabled. Please upgrade to using Environment Files or opt into unsecure command execution by setting the ACTIONS_ALLOW_UNSECURE_COMMANDS environment variable to true. For more information see: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/

uses: mathrix-education/[email protected]

Maybe upgrade @actions/core as suggested in #19 might fix it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.