Skip to content
77 linesCodeBlameRaw

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

Merge branch 'worktree-agent-a4d35ee70c50683d0' into claude/cool-newton-7nm8r91# g1t/deploy
2
3Builds the checkout a g1t Actions job is in and puts it on
4[g1t.page](https://docs.g1t.sh/guides/deployments/): production when the
5run is on the project's production branch, the pull request's preview for
6a pull request's run, and the branch's preview for a run on any other
7branch.
8
9```yaml
10name: Deploy
11
12on:
13 push:
14 branches: [main]
15 pull_request:
16
17permissions:
18 contents: read
19 deployments: write
20
21jobs:
22 deploy:
23 runs-on: ubuntu-latest
24 steps:
25 - uses: actions/checkout@v5
26 - id: deploy
27 uses: g1t/deploy@v1
28 - run: echo "Live at ${{ steps.deploy.outputs.url }}"
29```
30
31The project must have Deployments on, and the workspace's plan must
32include them. The guide,
33[Deploying from a workflow](https://docs.g1t.sh/guides/deployments/#deploying-from-a-workflow),
34says what is built and when.
35
36## Inputs
37
38| Input | Default | |
39| --- | --- | --- |
40| `project` | The repository's one project with Deployments on | The project's slug. Needed when the repository has several. |
41| `root-dir` | The project's setting | Where the project is in the checkout. |
42| `build-command` | The project's setting, else what the build finds | What builds it. |
Merge GitHub pull request #8 (claude/cool-newton-7nm8r9): Docker deployments on g1t.page behind a switch that stays off until Cloudflare's container APIs are checked live, workflows a workspace manages in its repositories, tarball and zipball downloads, refs/pull/* kept to g1t alone, framework detection for g1t.page builds, and a workflow's event payload matching GitHub's.43| `output-dir` | The project's setting, else the folder the framework writes, else the first of `dist`, `build`, `out`, `public`, `_site`, `.output/public` | The folder a static build writes. |
44| `build-as` | The project's setting, else `auto` | What it is built as: `auto`, `static`, `workers` or `docker`. A container is built with the `docker` on the job's `PATH`. |
45| `dockerfile` | The project's setting, else `Dockerfile` or `Containerfile` | The Dockerfile a container is built from, relative to the project. |
Merge branch 'worktree-agent-a4d35ee70c50683d0' into claude/cool-newton-7nm8r946| `sha` | The run's commit | The commit this is a build of, for its `g1t / deploy` check. |
47| `token` | `${{ github.token }}` | The job's own token. It needs `deployments: write`; any other token is refused. |
48
49## Outputs
50
51| Output | |
52| --- | --- |
53| `url` | Where the app is served. |
54| `deployment-id` | The build's id, `dpl_…`. |
55| `kind` | `production` or `preview`. |
56
57## How it works
58
591. It calls `POST /repos/{owner}/{repo}/deployments/builds` with the job's
60 token. g1t checks the plan and the spend limit, decides production or
61 preview from the run, sets the commit's `g1t / deploy` check to pending,
62 and answers with a token for this build alone and the project's
63 variables and secrets for builds of that kind.
642. It masks that token and every secret with `::add-mask::`.
653. It runs `g1t-runner deploy` in the checkout, which installs, builds and
66 uploads the app exactly as g1t's own builds do, and reports to g1t with
67 the build's token. The build's log is in the step's.
68
69A pull request from a fork or from someone without the Write role, and a
70run that had to be approved, build without the project's secrets. The
71build's time is the job's Actions time; it is not charged again.
72
73`g1t-runner` is on g1t's machines. Elsewhere (a self-hosted runner), the
74action uses the one on `PATH`, or downloads the newest release from
75`https://g1t.sh/downloads/runner/latest/` and checks it against the
76release's `SHA256SUMS`. It runs on Linux and macOS, with `curl` and either
77`jq` or `python3`.

This file's history is long; its oldest lines are credited to the oldest commit read.