Setting Up the GitHub Repository

Your first task after your Liferay Cloud account is provisioned is to set up the project’s Git repository so you can deploy configurations as an administrator. Marcus must follow this procedure as the Delectable Bonsai project’s administrator.

Set up the repository and complete your first push to ensure it’s working.

note

You must have the CLI tool installed to continue with this course.

Fork and Clone the GitHub Repository

First, you must install Git and create your own fork of the GitHub repository. For the Delectable Bonsai project, Marcus must follow all of these steps for the initial setup, but Kyle needs only perform the last two steps (clone and add a remote repository) as a contributor.

You’ll transfer your Liferay Cloud project to your fork for new builds.

  1. Set up Git on your local system.

  2. Open your provisioned repository’s page on GitHub.

    tip

    If you don’t have the link to your project’s repository, navigate to the Builds page in the Liferay Cloud console and click the link under Branch for the most recent build. This link points to a specific branch in the provisioned repository.

  3. Create your own fork of the repository.

  4. Clone the fork you created on your local system.

  5. In your command prompt (with Git installed), add your fork as an (upstream) remote repository.

Now you have a forked repository that you own with the Liferay Cloud project structure, locally and on GitHub.

Configure the Webhook

Next, configure a webhook so Liferay Cloud can access your repository.

  1. On the GitHub website, go to your repository’s Settings page and click Webhooks.

    Configure the webhook via your GitHub repository's Settings page.

  2. Click Add Webhook.

  3. In the Payload URL field, add the domain of your Liferay Cloud infra environment’s CI service with github-webhook/ at the end (e.g., https://ci-delectablebonsai-infra.lfr.cloud/github-webhook/ for the delectablebonsai project).

  4. In the Content type drop-down menu, select application/json.

  5. Ensure that Enable SSL verification is selected.

    Fill out the form for the new webhook and finish by selecting the events that trigger it.

  6. Under Which events would you like to trigger this webhook?, select Let me select individual events.

  7. Select Pushes and Pull Requests from the list of events that appears.

    Select pushes and pull requests so that they trigger builds in your Liferay Cloud project.

  8. Ensure that the Active checkbox is selected.

  9. Click Add webhook.

Now Liferay Cloud can access your repository.

Point Liferay Cloud to Your Private Repository

Finally, configure the CI service in your infra environment to work with the private repository.

  1. Log in to the Liferay Cloud console.

  2. Navigate to your infra environment, and click Services.

  3. Select the CI service.

  4. Under the Environment Variables tab, add the values for these environment variables:

    NameValue
    LCP_CI_SCM_PROVIDERgithub
    LCP_CI_SCM_REPOSITORY_NAME[Your repository’s name]
    LCP_CI_SCM_REPOSITORY_OWNER[Your repository owner’s account]
    LCP_CI_SCM_TOKEN[Personal access token]

    Use a personal access token that has every permission checked under the repo and admin:repo_hook categories.

Once the CI service restarts, any pushes or pull requests to your private repository trigger new builds in your Liferay Cloud project.

Next: configure your site to use your own custom domain.

Capabilities

Product

Contact Us

Connect

Powered by Liferay
© 2024 Liferay Inc. All Rights Reserved • Privacy Policy