Skip to content

Commit b5b012d

Browse files
committed
Add Makefile for staging deployment and update README with usage instructions
1 parent 8fd957b commit b5b012d

2 files changed

Lines changed: 50 additions & 0 deletions

File tree

Makefile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Usage:
2+
# make staging # channel = current git branch, expires in 7d
3+
# make staging CHANNEL=my-channel # custom channel name
4+
# make staging CHANNEL=my-channel EXPIRES=14d
5+
# make build # just build the site
6+
# make deploy-staging # deploy without rebuilding
7+
8+
SHELL := /usr/bin/env bash
9+
.SHELLFLAGS := -eu -o pipefail -c
10+
11+
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
12+
CHANNEL ?= $(BRANCH)
13+
EXPIRES ?= 7d
14+
15+
# Firebase channel IDs must match [a-zA-Z0-9_-]
16+
SAFE_CHANNEL := $(shell echo "$(CHANNEL)" | tr '/' '-' | tr -c 'a-zA-Z0-9_-' '-' | sed 's/-\+/-/g; s/^-//; s/-$$//')
17+
18+
.PHONY: staging build deploy-staging check-firebase
19+
20+
staging: build deploy-staging
21+
22+
build:
23+
npm run build
24+
25+
deploy-staging: check-firebase
26+
@echo "Branch: $(BRANCH)"
27+
@echo "Channel: $(SAFE_CHANNEL)"
28+
@echo "Expires: $(EXPIRES)"
29+
firebase hosting:channel:deploy "$(SAFE_CHANNEL)" --expires "$(EXPIRES)"
30+
31+
check-firebase:
32+
@command -v firebase >/dev/null 2>&1 || { \
33+
echo "firebase CLI not found. Install with: npm install -g firebase-tools" >&2; \
34+
exit 1; \
35+
}

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,21 @@ You may want to run the docs site locally to test and visualize changes you are
2828
1. **Install Dependencies:** Run **`npm install`** in your terminal to install the necessary dependencies.
2929
2. **Preview Changes:** To see your changes in real-time as you edit the files, you can run a local development server. This server will host your website and reflect the latest changes. Use the command **`npm run start`**.
3030

31+
## Deploying a Staging Preview
32+
To share your branch with reviewers before merging, deploy it to a Firebase Hosting preview channel. This builds the site and publishes it to a temporary URL (defaults to a 7-day expiry).
33+
34+
```bash
35+
make staging # channel name = current git branch
36+
make staging CHANNEL=my-channel # custom channel name
37+
make staging CHANNEL=my-channel EXPIRES=14d
38+
```
39+
40+
Other targets:
41+
- `make build` — build the site only
42+
- `make deploy-staging` — deploy without rebuilding
43+
44+
Requires the Firebase CLI (`npm install -g firebase-tools`) and access to the `flutterflow-docs-82026` Firebase project.
45+
3146
## Ready to Contribute?
3247
Your contributions are vital to keeping FlutterFlow's documentation clear, up-to-date, and helpful. We look forward to seeing your pull requests and are excited to welcome you into our community of contributors!
3348

0 commit comments

Comments
 (0)