Was this page helpful?

Deploy a custom app

Deploy app to your organization in Contentful

To deploy your app and make it available to the users in your Contentful organization, you must create a production build of your app and host it with Contentful app hosting.

The production build can be created with a build script provided by create-contentful-app tool.

To deploy your custom app:

  1. Create a production build by running the following command:
npm run build
  1. Upload your app to your organization by running the following command:
npm run upload
  1. Follow the prompts by Contentful CLI to generate and copy an access token, select the required organization and app.
Alternatively, you can provide this information through environment variables (`CONTENTFUL_ACCESS_TOKEN`, `CONTENTFUL_ORG_ID`, `CONTENTFUL_APP_DEF_ID`). To learn more , check Contentful app-scripts reference.

Automate deployment with GitHub Action

@contentful/actions-app-deploy is a custom GitHub Action to deploy a static Contentful app to Contentful App Hosting via GitHub Actions.

Usage

After building your app, add the following step to your existing GitHub Actions job:

- uses: contentful/actions-app-deploy@v1
  with:
    organization-id: ${{ secrets.ORGANIZATION_ID }}
    app-definition-id: ${{ secrets.APP_DEFINITION_ID }}
    access-token: ${{ secrets.ACCESS_TOKEN }}
    folder: build

When the job is run, the files are automatically uploaded as an AppBundle and promoted to the active bundle of the app definition. The new app is immediately served to all users.

Read more about deploying with GitHub Action