clasp icon indicating copy to clipboard operation
clasp copied to clipboard

Provide instructions for deploying via CI

Open pjaws opened this issue 5 years ago • 12 comments

(Note: Non-breaking issues are likely not to be prioritized. Please consider a PR in addition to your issue)

Expected Behavior

Most serious production applications will require CI/CD. A user should be able to read the documentation and understand the requirements and process for implementing this.

Actual Behavior

There is no documentation on this.

Steps to Reproduce the Problem

  1. Install clasp on CI server
  2. Attempt to login with credentials file as outlined in the docs.
  3. clasp either attempts to open a browser window on the server or requires user input when --no-localhost option is used.
  4. Build hangs

Specifications

  • Node version (node -v): 10.16.3
  • Version (clasp -v): 2.3.0
  • OS (Mac/Linux/Windows): Linux

I would really appreciate any help in getting around this login issue. I've tried searching through the existing related issues and did not find a solution. Thank you.

pjaws avatar Oct 10 '19 17:10 pjaws

The best would be to have an example using Github Actions I have added a .clasprc.json and creds.json files content to Github secrets and using it as environment variables. But clasp is activating login by URL which I cannot provide

sativ01 avatar Apr 20 '20 11:04 sativ01

In CI/CD, I consider the following commands should be modified to be able to run on local credentials

  • clasp push
  • clasp deploy
  • clasp run

Note: This assumes that you have an encrypted .clasprc.json committed to the repository.

Currently, only clasp run works with .clasprc.json.

I propose the ability for CLAPS to run only on local credentials when the --local option is specified, as follows

clasp push --local

clasp deploy is the same as the above too.

fossamagna avatar Apr 21 '20 08:04 fossamagna

Wow, I just tried to setup a CI workflow and I was going to open a new issue asking what to do about the interactive login step. So after setting up all the google project and that stuff this is indeed not supported. How long is this from being implemented? Is this considered or is it a won't do?

danielo515 avatar Aug 31 '20 09:08 danielo515

FYI

I've developed a CI/CD process for Google Apps Script using GitHub Actions.

See my repo here: https://github.com/ericanastas/deploy-google-app-script-action

It works by creating a .clasprc.json from a Github repository secret, but then uses hmanzur/actions-set-secret to update the stored secret value when the tokens change.

In addition to push triggers there's also a schedule trigger that runs one a week to login to clasp and keep the tokens in the secret refreshed.

ericanastas avatar May 19 '21 18:05 ericanastas

See my repo here: https://github.com/ericanastas/deploy-google-app-script-action

Interesting! By the way that 404s - private?

marcosscriven avatar May 19 '21 18:05 marcosscriven

Sorry, it's public now.

See my repo here: https://github.com/ericanastas/deploy-google-app-script-action

Interesting! By the way that 404s - private?

ericanastas avatar May 19 '21 18:05 ericanastas

@ericanastas Interesting!

oshliaer avatar May 20 '21 13:05 oshliaer

An official CI/CD workflow would be a great option

muddi900 avatar Jan 11 '23 09:01 muddi900

FYI

I've developed a CI/CD process for Google Apps Script using GitHub Actions.

See my repo here: https://github.com/ericanastas/deploy-google-app-script-action

It works by creating a .clasprc.json from a Github repository secret, but then uses hmanzur/actions-set-secret to update the stored secret value when the tokens change.

In addition to push triggers there's also a schedule trigger that runs one a week to login to clasp and keep the tokens in the secret refreshed.

10/10 solution. Wish there were a better one. But this one is as good it gets tbh.

DOZBORNE avatar Mar 15 '24 05:03 DOZBORNE