clasp
clasp copied to clipboard
Provide instructions for deploying via CI
(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
- Install clasp on CI server
- Attempt to login with credentials file as outlined in the docs.
- clasp either attempts to open a browser window on the server or requires user input when --no-localhost option is used.
- 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.
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
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.
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?
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.
See my repo here: https://github.com/ericanastas/deploy-google-app-script-action
Interesting! By the way that 404s - private?
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 Interesting!
An official CI/CD workflow would be a great option
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.