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.
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.
-
Set up Git on your local system.
-
Open your provisioned repository’s page on GitHub.
tipIf 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.
-
Create your own fork of the repository.
-
Clone the fork you created on your local system.
-
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.
-
On the GitHub website, go to your repository’s Settings page and click Webhooks.
-
Click Add Webhook.
-
In the Payload URL field, add the domain of your Liferay Cloud
infra
environment’s CI service withgithub-webhook/
at the end (e.g.,https://ci-delectablebonsai-infra.lfr.cloud/github-webhook/
for thedelectablebonsai
project). -
In the Content type drop-down menu, select application/json.
-
Ensure that Enable SSL verification is selected.
-
Under Which events would you like to trigger this webhook?, select Let me select individual events.
-
Select Pushes and Pull Requests from the list of events that appears.
-
Ensure that the Active checkbox is selected.
-
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.
-
Log in to the Liferay Cloud console.
-
Navigate to your
infra
environment, and click Services. -
Select the CI service.
-
Under the Environment Variables tab, add the values for these environment variables:
Name Value LCP_CI_SCM_PROVIDER
github
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.