Create and manage deployments

An Apps Script project deployment is a version of the script that is made available for use as a web app, add-on, or API executable. By creating and managing deployments, you can iterate on your code, keep track of your changes, and control the exact code version your users have access to.

There are two types of deployments:

  • Head deployments, which are always synced to the current project code.
  • Versioned deployments, which are connected to a specific project version.

Head deployments

A head deployment is the current project code. When you create an Apps Script project, you automatically create a head deployment for that project.

The head deployment is always in sync with most recently saved code. For example, if you create a versioned deployment and then modify your code, the head deployment reflects those changes, while the versioned deployment remains intact.

Use head deployments to test code. Don't use head deployments for public use.

Versioned deployments

A versioned deployment makes a specific version of the project code available. This lets your users continue to use a functioning version while you make changes and improvements to the code.

When your application is published for public consumption, always use a versioned deployment. You can have multiple active versioned deployments at one time.

Important: You can't transfer ownership of versioned deployments. If you transfer ownership of a script project to someone, the owner of the existing versioned deployments within the project doesn't change. If an administrator deletes the deployment owner's account, you might experience script errors for their deployments.

Create a versioned deployment

To deploy a version of a Google Workspace Add-on, Editor Add-on, Google Chat app, or an API executable, you must first switch your Apps Script’s Google Cloud project association from the default project to a standard project.

To create a versioned deployment, follow these steps:

  1. Open the Apps Script project.
  2. At the top right, click Deploy > New deployment.
  3. Next to Select type click Enable deployment types .
  4. Select the deployment type that you want to deploy. For Google Workspace Add-ons, Editor Add-ons, and Google Chat apps, select Add-on.
  5. Enter the information about your deployment and click Deploy.

View versioned deployments

To view the deployments of an Apps Script project, at the top, click Deploy > Manage deployments.

To view the code of a specific version, refer to View a previous version.

Edit a versioned deployment

You can edit a versioned deployment to change its description or version. To edit a deployment, follow these steps:

  1. Open the Apps Script project.
  2. Click Deploy > Manage deployments.
  3. Select the active deployment you want to change and click Edit .
  4. Make your changes and click Deploy.

    If you want to edit an archived deployment, you must redeploy it, then follow the preceding steps.

    When you want to deploy a change to the project code, create a new version and edit the deployment to use it. The new version is automatically used by any users that use that deployment.

Find a deployment ID

Every deployment has an associated string ID automatically created for it. To find this ID, follow the steps below:

  1. Open the Apps Script project.
  2. At the top right, click Deploy > Manage deployments.
  3. Select an active deployment to find its ID.

    Deployment IDs only appear on active deployments.

Test a deployment

How you test a deployment depends on the type of app you build.

Google Workspace Add-on

To test a Google Workspace Add-on deployment, see Testing Google Workspace Add-ons.

Editor Add-on

To test an Editor Add-on deployment, see Test an Editor Add-on.

Web app

To test a web app deployment, see Test a web app deployment.

Google Chat app

To test a Chat app deployment, you must first create a versioned deployment of the script to access its deployment ID.

Once you have the deployment ID, follow the steps to enable the Google Chat API. On the Configuration page under "Permissions," specify only your email address so that you can install and test your app.

API Executable

To test an API executable deployment, you must first create a versioned deployment. After you create a deployment, follow the steps below:

  1. At the top right of the Apps Script project, click Deploy > Test Deployments.
  2. Next to ”Select type,” click Enable deployment types > API Executable.
  3. Copy and use the URL to test your API Executable deployment.

Archive a versioned deployment

You can't delete versioned deployments. Instead, you can archive them.

To archive a versioned deployment:

  1. Open the Apps Script project.
  2. Click Deploy > Manage deployments.
  3. Select the deployment you want to archive and click Archive deployment .

Redeploy an archived deployment

  1. Open the Apps Script project.
  2. At the top right, click Deploy > Manage deployments.
  3. At the left under Archived, select the deployment you want to redeploy and click Edit > Deploy.