Git and CI
Publish from Git: connect a GitHub repository, push straight to Perafly, or publish from your CI. The production branch goes live; other branches get preview addresses.
Three ways
In every case only committed content is published, the files go through the same filters as any publish, the build runs on the hosting provider and the result is a version. Git needs a project with an account.
Branches and previews
The branch part of the address is lower case, with every character that isn't a letter or digit turned into -. The production branch is main unless you change it. The number of active branch previews per project comes from your plan; past it, the branch updated longest ago loses its address (its version stays).
Connect GitHub
- Open the project's Git tab in the dashboard and install the Perafly GitHub App. You can give it access to selected repositories only.
- Pick the repository. Or from a terminal, once the app is installed:
The app asks GitHub for read access to contents and metadata, and write access to pull requests (for the comment) and commit statuses. If the repository appears in more than one installation, add --installation <id>. Agent credentials can't change these settings.
Direct push
perafly git remote adds the project's push address to the repository as a remote named perafly (it never touches origin) and sets the CLI as Git's credential helper for that address only. Your key is never written into the address or Git's configuration.
- The push needs
publish.write. The password is an API key: the credential helper gives your sign-in orPERAFLY_TOKEN. - Only branches are published; tags are accepted but not published. Pulling from the address is closed.
- Pushing the production branch with an agent sign-in waits for approval like any change to live.
perafly git remote --name <name>uses another remote name.
Publish from CI
perafly publish finds the branch and commit in GitHub Actions, GitLab CI, Bitbucket Pipelines and CircleCI and sends them with the publish. Without --target, the project's branch rule decides: the production branch goes live, other branches get branch previews. --branch and --commit work anywhere and win over what CI reports.
GitHub Actions
Create the key with perafly api-keys create ci (or in team Settings) and store it as the PERAFLY_TOKEN secret. In CI the CLI writes JSON and never asks questions; that doesn't mean --yes.
Build settings
Build commands and the folder to build in (for one project in a larger repository) go in perafly.jsonc: build.rootDirectory, installCommand, buildCommand, outputDirectory. Whatever you leave out is detected by the hosting provider. How many builds a team runs at once comes from its plan; a newer push to the same branch replaces a build that hasn't started.
Disconnecting stops new builds; published versions stay. Rolling back moves live to an older version; it doesn't change your repository.