Skip to content

Commit cc7ecd5

Browse files
authored
Document deployments (#204)
1 parent b6cf487 commit cc7ecd5

20 files changed

Lines changed: 532 additions & 126 deletions

docs/introduction.mdx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import { HelpSection } from "@site/src/partials";
99
import CypressLogo from "@site/src/img/frameworks/cypress.png";
1010
import PlaywrightLogo from "@site/src/img/frameworks/playwright.png";
1111
import PuppeteerLogo from "@site/src/img/frameworks/puppeteer.png";
12-
import NextjsLogo from "@site/src/img/frameworks/next-js.png";
13-
import ReactRouterLogo from "@site/src/img/frameworks/react-router.png";
1412
import WebdriverIOLogo from "@site/src/img/frameworks/webdriverio.png";
1513
import StorybookLogo from "@site/src/img/frameworks/storybook.png";
1614
import OthersLogo from "@site/src/img/frameworks/others.png";
@@ -55,12 +53,6 @@ Learn how to setup Argos in your project:
5553
text="Puppeteer Quickstart"
5654
to="/quickstart/puppeteer"
5755
/>
58-
<XCard logo={NextjsLogo} text="Next.js Quickstart" to="/quickstart/next-js" />
59-
<XCard
60-
logo={ReactRouterLogo}
61-
text="React Router Quickstart"
62-
to="/quickstart/react-router"
63-
/>
6456
<XCard
6557
logo={OthersLogo}
6658
text="Any E2E Quickstart"
@@ -74,6 +66,7 @@ Dig deeper into Argos topics:
7466

7567
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 flex-wrap">
7668
<XCard text="Baselines & monitoring" to="/baseline-build" />
69+
<XCard text="Deployments" to="/deployments" />
7770
<XCard text="Integrations" to="/integrations" />
7871
<XCard text="Flaky test detection" to="/flaky-test-detection" />
7972
</div>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"label": "Deployments",
3+
"position": 3
4+
}
146 KB
Loading
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
slug: /deployments/authentication
3+
sidebar_label: Access protection
4+
sidebar_position: 4
5+
description: Restrict who can access your deployment URLs by requiring viewers to sign in with Argos.
6+
---
7+
8+
# Access protection
9+
10+
By default, deployment URLs are reachable by anyone who has the link. For most internal projects, that's not what you want—a Storybook can leak unreleased designs, copy, or features. Argos lets you require viewers to sign in with an Argos account before opening any deployment URL.
11+
12+
Access protection is configured per project, and applies to every deployment under it.
13+
14+
## Protection modes
15+
16+
Argos supports three modes:
17+
18+
| Mode | Preview URLs | Production domain | Available on |
19+
| :---------------------- | :---------------- | :---------------- | :----------- |
20+
| **Public** | No login required | No login required | All plans |
21+
| **Standard protection** | Login required | No login required | All plans |
22+
| **All deployments** | Login required | Login required | Team plans |
23+
24+
When login is required, only Argos users who have access to the project can open the deployment. Everyone else sees the Argos sign-in screen.
25+
26+
### Public
27+
28+
Everyone with the link can open the deployment. Use this if your project is fully public (for example, an open-source design system) or if the build is intentionally meant to be shared.
29+
30+
### Standard protection
31+
32+
Login required for every URL **except** the production domain. The production domain stays public; all preview URLs and the immutable deployment URLs require sign-in.
33+
34+
This is the right default for most teams: production is browsable by anyone (designers, customers, stakeholders), while previews stay private to your team.
35+
36+
### All deployments
37+
38+
Login required for **all** URLs, including the production domain. Use this when the production build itself contains sensitive material—for example, internal tools or a Storybook for unreleased features.
39+
40+
This option requires a Team plan.
41+
42+
## Configure access protection
43+
44+
1. Open your project in Argos.
45+
2. Go to **Settings → Deployments**.
46+
3. Toggle **Log in protection** and pick the level.
47+
48+
![Deployment authentication setting](./auth-setting.png)
49+
_Project Settings → Deployments → Deployment authentication._
50+
51+
Changes take effect immediately on the next request.
52+
53+
## Who can access protected deployments
54+
55+
When login protection is enabled, a viewer must:
56+
57+
1. Be signed in to Argos.
58+
2. Have access to the project the deployment belongs to.
59+
60+
Project access follows the [team roles and permissions](/team-members-and-roles) rules: team members, contributors invited to the project, and account owners.
61+
62+
A viewer who does not have access sees a 404-style screen rather than a sign-in prompt, so the existence of the project is not disclosed.
63+
64+
## Related
65+
66+
- [Deployments overview](/deployments)
67+
- [URLs and domains](/deployments/urls)

docs/learn/deployments/ci.mdx

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
---
2+
slug: /deployments/ci
3+
sidebar_label: Use in CI
4+
sidebar_position: 5
5+
description: Deploy a Storybook (or any static build) to Argos automatically on every pull request from GitHub Actions.
6+
---
7+
8+
import { RunPkgCommand } from "@site/src/partials";
9+
10+
# Use deployments in CI
11+
12+
Running `argos deploy` from CI is the most common setup: a new deployment is created on every push to a pull request, and the deployment link appears in the PR comment alongside Argos visual tests.
13+
14+
This page walks through a GitHub Actions setup for Storybook. The same pattern works for any static build and any CI provider.
15+
16+
## Prerequisites
17+
18+
- A static build step that produces a directory (for Storybook: `npm run build-storybook``storybook-static/`).
19+
- An `ARGOS_TOKEN` available as a CI secret. You can also use [GitHub OIDC](/github-oidc) or [tokenless authentication](/github-tokenless) to avoid managing a secret.
20+
21+
## GitHub Actions example
22+
23+
```yaml title=".github/workflows/argos-deploy.yml"
24+
name: Deploy Storybook to Argos
25+
26+
on:
27+
pull_request:
28+
push:
29+
branches:
30+
- main
31+
32+
jobs:
33+
deploy:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v6
37+
- uses: actions/setup-node@v6
38+
- run: npm ci
39+
- run: npm run build-storybook
40+
- run: npx --no-install argos deploy ./storybook-static
41+
env:
42+
ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }}
43+
```
44+
45+
A few notes:
46+
47+
- The workflow listens to both `pull_request` and `push` to `main`. Pull request runs produce **preview** deployments; pushes to `main` produce **production** deployments (because `main` matches the default production branch pattern—see [Environments](/deployments/environments)).
48+
- `actions/checkout` gives Argos the commit SHA and branch it needs to associate the deployment with the right pull request.
49+
- The `ARGOS_TOKEN` is the project token from **Settings → General → Token**.
50+
51+
## Force a production deployment
52+
53+
If your production branch differs from your repository's default branch (or if you want to be explicit), pass the `--prod` flag:
54+
55+
```yaml
56+
- run: npx --no-install argos deploy ./storybook-static --prod
57+
env:
58+
ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }}
59+
```
60+
61+
You can keep the same workflow for both preview and production by branching on the event:
62+
63+
```yaml
64+
- name: Deploy
65+
run: |
66+
if [ "${{ github.event_name }}" = "push" ]; then
67+
npx --no-install argos deploy ./storybook-static --prod
68+
else
69+
npx --no-install argos deploy ./storybook-static
70+
fi
71+
env:
72+
ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }}
73+
```
74+
75+
## Combine with visual testing
76+
77+
The `deploy` and `upload` commands are independent: you can run both in the same workflow to get a deployment URL **and** Argos visual tests on the same commit.
78+
79+
```yaml
80+
- run: npm run build-storybook
81+
- run: npm run test:visual # Your usual Argos visual test job
82+
env:
83+
ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }}
84+
- run: npx --no-install argos deploy ./storybook-static
85+
env:
86+
ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }}
87+
```
88+
89+
Argos posts a single pull request comment that lists both the deployment URLs and the visual build results.
90+
91+
![Pull request comment with deployment and visual build rows](./pr-comment.png)
92+
_GitHub pull request comment showing both the deployment and the Argos visual build._
93+
94+
## Status checks
95+
96+
Each deployment registers a commit status named `argos-deploy/<project>`. The status starts as **pending** when the upload begins and becomes **success** when the deployment is ready. You can require it in your branch protection rules if a missing deployment should block a merge.
97+
98+
## Other CI providers
99+
100+
The `argos deploy` command has no GitHub-specific behavior. To run it on another CI provider:
101+
102+
1. Build your static directory in your pipeline.
103+
2. Set `ARGOS_TOKEN` as a secret.
104+
3. Run `argos deploy <directory>` (add `--prod` for production).
105+
106+
Argos automatically detects the commit SHA, branch, and pull request number from the most common CI environment variables.
107+
108+
## Related
109+
110+
- [Deployments overview](/deployments)
111+
- [Environments](/deployments/environments)
112+
- [GitHub integration](/github)
113+
- [Argos CLI reference](/argos-cli)
90.6 KB
Loading
81.3 KB
Loading
509 KB
Loading
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
slug: /deployments/environments
3+
sidebar_label: Environments
4+
sidebar_position: 2
5+
description: Argos provides two deployment environments—preview and production—each with its own URLs and access rules.
6+
---
7+
8+
import { RunPkgCommand } from "@site/src/partials";
9+
10+
# Environments
11+
12+
Every deployment is created in one of two environments:
13+
14+
- **Preview** — A non-production deployment, typically created from a feature branch or pull request. Each preview gets its own URL and never replaces the production deployment.
15+
- **Production** — The deployment served on your project's production domain. Only deployments from a production branch are promoted here.
16+
17+
The environment is decided when the deployment is created and cannot be changed afterwards.
18+
19+
## How the environment is determined
20+
21+
Argos picks the environment in this order:
22+
23+
1. **Explicit override.** If you pass `--prod` to the CLI (or `environment: "production"` to the SDK), the deployment is created as production.
24+
2. **Branch match.** Otherwise, the branch name is matched against the project's **production branch pattern**. A match → production. No match → preview.
25+
26+
By default, the production branch pattern follows your Git repository's default branch (usually `main`). You can override it from project settings.
27+
28+
## Preview deployments
29+
30+
Preview deployments are the default. They are created when:
31+
32+
- You run `argos deploy <directory>` without `--prod`, **and**
33+
- The branch does not match the production branch pattern.
34+
35+
Each preview deployment gets:
36+
37+
- A unique, immutable **deployment URL** — always points to that exact build.
38+
- A **branch URL** — always points to the latest preview on that branch. Useful to share a link that follows a feature branch as it evolves.
39+
40+
See [URLs and domains](/deployments/urls) for the full list of URLs Argos generates.
41+
42+
When a preview deployment is linked to a pull request, the deployment status appears in the [pull request comment](/pull-request-comments) and as a commit status check on the PR.
43+
44+
## Production deployments
45+
46+
A production deployment is created when:
47+
48+
- You run `argos deploy <directory> --prod`, **or**
49+
- The branch matches the production branch pattern.
50+
51+
When a new production deployment becomes ready, it is **promoted**: the project's production domain immediately starts serving the new build. Earlier production deployments remain available at their own URLs.
52+
53+
The Argos dashboard shows a **Current** badge next to the deployment that is currently serving the production domain.
54+
55+
![Current production deployment badge](./current-badge.png)
56+
_The deployments list highlights the deployment currently promoted to production._
57+
58+
## Configure the production branch
59+
60+
By default, Argos uses your Git repository's default branch as the production branch. You can customize this from **Settings → Deployments → Production deployment branch**.
61+
62+
![Production deployment branch setting](./prod-branch.png)
63+
_Project Settings → Deployments → Production deployment branch._
64+
65+
To customize:
66+
67+
1. Disable **Use GitHub repository's default branch**.
68+
2. Enter a [glob pattern](https://github.com/isaacs/minimatch) that matches your production branches.
69+
70+
Examples:
71+
72+
- `main` — Only the `main` branch.
73+
- `{main,production}` — Either `main` or `production`.
74+
- `release/**` — Any branch under `release/` (for example `release/2024-q4`).
75+
76+
Any branch matching the pattern produces a production deployment on the next CLI run, even without `--prod`.
77+
78+
## Forcing an environment from the CLI
79+
80+
You can force the environment regardless of the branch with the `--prod` flag:
81+
82+
<RunPkgCommand command="argos deploy ./storybook-static --prod" />
83+
84+
This is useful when you want to:
85+
86+
- Deploy a one-off production build from a local machine.
87+
- Promote a deployment from a non-standard branch (for example, a release branch that doesn't match the configured pattern).
88+
89+
There is currently no flag to force a preview from a production branch—simply do not pass `--prod` and adjust the production branch pattern if needed.
90+
91+
## Related
92+
93+
- [Deployments overview](/deployments)
94+
- [URLs and domains](/deployments/urls)
95+
- [Use deployments in CI](/deployments/ci)

docs/learn/deployments/index.mdx

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
slug: /deployments
3+
sidebar_label: Overview
4+
sidebar_position: 1
5+
description: Deploy static builds like Storybook to Argos on every pull request and review them on a live URL.
6+
---
7+
8+
import { RunPkgCommand } from "@site/src/partials";
9+
10+
# Deployments
11+
12+
A **deployment** on Argos is a static build—most commonly a Storybook—served on a unique URL that you can open, share, and review. Every time you run the Argos CLI, Argos uploads your build, generates a URL, and posts the status back to your pull request.
13+
14+
Use deployments to:
15+
16+
- Preview a Storybook for every pull request, with no infrastructure of your own to maintain.
17+
- Share a live link with designers, product, or stakeholders to review work in context.
18+
- Browse the history of every deployed build across branches and commits.
19+
20+
![Deployments list in the Argos dashboard](./deployments-list.png)
21+
_Deployments list in the Argos dashboard._
22+
23+
## How it works
24+
25+
A deployment is created in three phases:
26+
27+
1. **Build** — The Argos CLI scans your local directory and computes a content hash for every file.
28+
2. **Upload** — Argos returns pre-signed upload URLs for the files it doesn't already have. Files that match an existing hash are skipped, so re-deploying an unchanged build is near-instant.
29+
3. **Serve** — Once the upload finishes, Argos finalizes the deployment, assigns it a URL, and reports the status to your Git provider.
30+
31+
Each deployment is **immutable**. Re-running the deploy command always produces a new deployment with its own URL—the previous one keeps working.
32+
33+
## Quickstart
34+
35+
The following steps get a Storybook deployed in under a minute. The same flow works for any static directory (Vite build, Next.js export, plain HTML, etc.).
36+
37+
### 1. Install the Argos CLI
38+
39+
<RunPkgCommand command="npm install --save-dev @argos-ci/cli" />
40+
41+
### 2. Build your static site
42+
43+
Generate the directory you want to deploy. For Storybook:
44+
45+
```bash
46+
npm run build-storybook
47+
```
48+
49+
This produces a `storybook-static/` directory.
50+
51+
### 3. Deploy
52+
53+
<RunPkgCommand command="argos deploy ./storybook-static" />
54+
55+
The CLI uploads your build and prints a unique URL when the deployment is ready:
56+
57+
```
58+
✔ Deployed: https://my-project-abcd123-acme.argos-ci.live
59+
```
60+
61+
By default, the deployment is created in the **preview** environment. To deploy to **production**, add the `--prod` flag:
62+
63+
<RunPkgCommand command="argos deploy ./storybook-static --prod" />
64+
65+
See [Environments](/deployments/environments) for the rules that decide which environment a deployment lands in.
66+
67+
## Authentication
68+
69+
The deploy command uses the same authentication as the rest of the Argos CLI. Set the `ARGOS_TOKEN` environment variable in CI:
70+
71+
```bash
72+
ARGOS_TOKEN=<your-project-token>
73+
```
74+
75+
You can find the project token in **Settings → General → Token**. On GitHub Actions, you can also use [OIDC](/github-oidc) or [tokenless authentication](/github-tokenless) to avoid managing a secret.
76+
77+
## What's next
78+
79+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
80+
81+
- [**Environments**](/deployments/environments) — How preview and production deployments are determined, and how to customize the production branch.
82+
- [**URLs and domains**](/deployments/urls) — The URLs Argos generates for each deployment, and how to set the production domain.
83+
- [**Access protection**](/deployments/authentication) — Restrict who can open deployment URLs.
84+
- [**Use in CI**](/deployments/ci) — Deploy automatically on every pull request with GitHub Actions.
85+
86+
</div>

0 commit comments

Comments
 (0)