Deploy from GitHub
Connect a repository so a push to a branch builds and deploys the target that tracks it
Goal. A push to main in acme's repository builds api on the platform and rolls
it, without a local docker.
Apply first
Push-to-deploy resolves a branch to a target through the applied configuration, so the targets must exist before a push can reach them:
pier applyConnect the repository
pier github connectThe command opens the browser to install Pier's GitHub App on the repository, or selects
a repository the App already has access to (--repo owner/name skips the picker). It then
asks which branch deploys which target, writes the answer to pier.yaml and applies it:
vcs:
provider: github
repo: acme-inc/acme
auto_deploy: true
environments:
prod:
apps:
- name: api
build_context: ./api
targets:
- name: primary
deploy:
branch: mainpier github status shows the connection:
pier github statusAccount Linked (@piercomputing)
Status Not connected
Push
Every push to main now runs a build on the platform from the commit, and rolls
api/primary when it succeeds. pier deploys ls api lists it with the commit and
author; pier deploys logs <id> streams the build.
A push that changes only pier.yaml is applied without a build. A push to a branch that
no target tracks does nothing, unless previews are enabled
(Preview deployments).
Behaviour
- The push never reads
pier.yamlfrom the repository. Config changes are applied bypier applyfrom a checkout (or by a config-only push, once connected); the trigger table comes from what is applied. - A connection can go stale (the App uninstalled, the repository moved). Pushes are
then ignored,
pier github statussays so, and the connection heals when GitHub is reachable again;pier github connectrepairs it now. vcs.auto_deploy: falsekeeps the connection but ignores pushes.pier github setchanges which branch deploys which target;pier github disconnectremoves the connection.