Was this page helpful?

GitHub Action

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

Try it by running npx create-contentful-app --example typescript-github-action in your terminal. This will automatically set up a new project with a configured GitHub Actions workflow.

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.

Parameters

The GitHub Action requires four parameters to run:

Name Description
organization-id The id of the organization owning the app.
app-definition-id The id of the app.
access-token A personal access token for the Content Management API. Should be stored as a secret in your GitHub repository ( Settings -> Secrets -> Actions ).
folder The folder which is deployed to Contentful App Hosting. Usually, this is the build folder.
allow-tracking(optional) Flag that allows us to track the usage of the GitHub action. Accepted values can be either true or false , default value will be true .

Resources