---
title: "How to automate Google Apps Script deployments with GitHub Actions"
author: "Martin Hawksey"
date: 2022-06-10T14:09:48+00:00
modified: 2022-06-10T14:17:56+00:00
canonical_url: https://pulse.appsscript.info/p/2022/06/how-to-automate-google-apps-script-deployments-with-github-actions/
markdown_url: https://pulse.appsscript.info/p/2022/06/how-to-automate-google-apps-script-deployments-with-github-actions.md
categories:
  - "Comment"
  - "Intermediate"
  - "Solutions"
tags:
  - "@gorankukurin"
  - "Editor"
  - "gkukurin"
  - "Medium"
featured_image: https://pulse.appsscript.info/files/2022/06/Automate-Google-Apps-Script-deployments-with-GitHub-Actions.png
description: "Managing code particularly in container bound projects can be a real headache for Apps Script developers. The Script REST API has made this a lot easier both is terms of managing scripts but also opening up options for different development environments, including local development using clasp and your preferred IDE. My experience is Google Apps Script developers generally like automation and a lot of their Google Workspace solutions are automation problems. Using GitHub Actions is a great way you can also automate your software workflows. This contribution from Goran Kukurin is an excellent example of how you can make your Google Apps Script development less cumbersome and error-prone using GitHub Actions."
---

# How to automate Google Apps Script deployments with GitHub Actions

![How to automate Google Apps Script deployments with GitHub Actions](https://pulse.appsscript.info/files/2022/06/Automate-Google-Apps-Script-deployments-with-GitHub-Actions.png)

> Build an automated system that will be automatically deployed to one of the destination spreadsheets when the code is committed to the GitHub repository.

Managing code particularly in container bound projects can be a real headache for Apps Script developers. The Script REST API has made this a lot easier both is terms of managing scripts but also opening up options for different development environments, including local development using [`clasp`**](https://developers.google.com/apps-script/guides/clasp) and your preferred IDE.

In terms of version control there are a number of solutions Apps Script developers can now consider. The [Google Apps Script GitHub Assistant Chrome Extension**](https://chrome.google.com/webstore/detail/google-apps-script-github/lfjcgcmkmjjlieihflfhjopckgpelofo?hl=en) is a popular option as it extends the existing online Script Editor with integration with GitHub and several other Source Code Management services (GitHub Enterprise/Bitbucket/GitLab).

For developers interested in developing projects locally there is perhaps even more choice. One solution we’ve featured a couple of times in Pulse is the use of GitHub Actions:

> GitHub Actions makes it easy to automate all your software workflows, now with world-class CI/CD. Build, test, and deploy your code right from GitHub. Make code reviews, branch management, and issue triaging work the way you want.

The latest example for using GitHub Actions comes from Goran Kukurin ([gorankukurin.com**](https://gorankukurin.com/)). Goran has shared a setup for developing code in Google Sheets with development and production versions. As well as using GitHub Actions to automatically push code to the correct Google Sheet version a shell script is used to modify the custom menu name as a useful reminder so you can see what version you are testing:

[![](https://pulse.appsscript.info/files/2022/06/Automate-Google-Apps-Script-deployments-with-GitHub-Actions-1-e1654865750147-1024x425-1.png)](https://pulse.appsscript.info/files/2022/06/Automate-Google-Apps-Script-deployments-with-GitHub-Actions-1-e1654865750147.png)

You can visit Goran’s post (linked below) for an example repo and instructions on how to setup. If you are using a UNIX based operating system it should be straightforward. If like me you are on a Windows machine there are some minor tweaks and possibly big `node-gyp` headaches to overcome, which I’ve highlighted below (in Goran’s website post some commands with `--` are displaying as `-` – this [GitHub repo**](https://github.com/gkukurin/automate_apps_script_deployment) and [Medium version**](https://medium.com/@gkukurin/how-to-automate-google-apps-script-deployments-with-github-actions-d28d7fb8b879) are ok).

**Windows Tips**

You are better using PowerShell rather than CMD so you don’t have to modify things like `$HOME` to `%HOMEPATH%`.

If you’ve not already got `node-gyp`  installed the setup that worked for me on Windows 11 was:

- Node 14.19.3
- Python 3.10
- Visual Studio Build Tools 2017

After installing with `npm install -g node-gyp` there are [Windows specific setup instructions**](https://github.com/nodejs/node-gyp#on-windows) (don’t forget `npm config set msvs_version 2017`).

After creating the spreadsheets I needed to specify the directory by including `src` (I think this is a nit) e.g.:

`mv src\.clasp.json .clasp-prd.json`

To encrypt your clasp credentials you might need to install [install GnuPG**](https://www.gnupg.org/download/index.html).

If you are running the setup build tasks in VS Code and get:

`'.' is not recognized as an internal or external command`

I solved this by configuring `npm` to use `bash.exe`, some other options are give in [this SO answer**](https://stackoverflow.com/a/55303370/1027723).

**Final thought**

There is a lot more you could do with GitHub Actions like pushing to multiple production spreadsheets and much more. This post from Goran Kukurin is a great insight to what is possible and we look forward to seeing where other Apps Script devs go with it.

Source: *[How to automate Google Apps Script deployments with GitHub Actions*](https://gorankukurin.com/google-workspace/how-to-automate-google-apps-script-deployments-with-github-actions/) (also [published on Medium**](https://medium.com/@gkukurin/how-to-automate-google-apps-script-deployments-with-github-actions-d28d7fb8b879))

---

*Published by [Martin Hawksey](https://pulse.appsscript.info/p/author/admin/) on [Pulse](https://pulse.appsscript.info/). Original article: [https://pulse.appsscript.info/p/2022/06/how-to-automate-google-apps-script-deployments-with-github-actions/](https://pulse.appsscript.info/p/2022/06/how-to-automate-google-apps-script-deployments-with-github-actions/)*
