Skip to content

Commit 772199d

Browse files
committed
add staging deployment of documentation github pages
1 parent ba671c2 commit 772199d

File tree

3 files changed

+123
-0
lines changed

3 files changed

+123
-0
lines changed

.github/workflows/staging.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Deploy Staging to GitHub Pages
2+
3+
# This workflow deploys to procore-staging.github.io/documentation/
4+
#
5+
# Triggers:
6+
# 1. When any branch starting with "staging-" is pushed (e.g., staging-my-feature)
7+
# → Deploys that feature branch's content to staging
8+
# 2. When main branch is merged/pushed
9+
# → Deploys main branch's content to procore-staging.github.io
10+
# → This keeps staging in sync with the latest main branch content
11+
#
12+
# Both scenarios deploy to the same staging subdomain: procore-staging.github.io
13+
14+
on:
15+
push:
16+
branches:
17+
- 'staging-*' # Deploy when any branch starting with "staging-" is updated (e.g., staging-1, staging-feature)
18+
- main # Deploy main branch to procore-staging.github.io when main is merged/pushed
19+
workflow_dispatch: # Allow manual trigger
20+
21+
permissions:
22+
contents: read
23+
pages: write
24+
id-token: write
25+
26+
concurrency:
27+
group: "pages-staging"
28+
cancel-in-progress: false
29+
30+
jobs:
31+
build:
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v4
36+
37+
- name: Setup Ruby
38+
uses: ruby/setup-ruby@v1
39+
with:
40+
ruby-version: '3.1'
41+
bundler-cache: true
42+
43+
- name: Build with Jekyll (Staging)
44+
run: bundle exec jekyll build --config _config.yml,_config_staging.yml
45+
env:
46+
JEKYLL_ENV: staging
47+
48+
- name: Setup Pages
49+
uses: actions/configure-pages@v4
50+
51+
- name: Upload artifact
52+
uses: actions/upload-pages-artifact@v3
53+
with:
54+
path: ./_site
55+
56+
deploy:
57+
environment:
58+
name: github-pages-staging
59+
url: ${{ steps.deployment.outputs.page_url }}
60+
runs-on: ubuntu-latest
61+
needs: build
62+
steps:
63+
- name: Deploy to GitHub Pages
64+
id: deployment
65+
uses: actions/deploy-pages@v4
66+

STAGING_SETUP.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Staging Environment Setup for GitHub Pages
2+
3+
This guide explains how to set up a staging environment for the documentation that deploys to `procore-staging.github.io/documentation`.
4+
5+
## Feature Branch Staging Workflow
6+
7+
Use the same repository with `staging-*` branch pattern for per-feature staging deployments:
8+
9+
1. **Work on your feature branch** (e.g., `my-feature-change-1`)
10+
2. **Create a staging branch** with `staging-` prefix (e.g., `staging-my-feature-change-1`)
11+
3. **Push the staging branch** - the `.github/workflows/staging.yml` workflow will automatically:
12+
- Detect branches matching `staging-*` pattern
13+
- Build with staging configuration (`_config_staging.yml`)
14+
- Deploy to `procore-staging.github.io/documentation/`
15+
16+
**How it works:**
17+
- Any branch starting with `staging-` triggers the staging deployment workflow
18+
- Each feature can have its own staging branch: `staging-feature-name`
19+
- The workflow uses the staging config which sets `url: "https://procore-staging.github.io"`
20+
21+
**Example workflow:**
22+
```bash
23+
# 1. Work on your feature
24+
git checkout -b my-feature-change-1
25+
# ... make changes ...
26+
27+
# 2. When ready for staging, create staging branch
28+
git checkout -b staging-my-feature-change-1
29+
30+
# 3. Push to trigger staging deployment
31+
git push origin staging-my-feature-change-1
32+
# → GitHub Actions automatically builds and deploys to procore-staging.github.io
33+
```
34+
35+
## Main Branch Deployment to Staging
36+
37+
When the `main` branch is merged or pushed, it will also automatically deploy to `procore-staging.github.io/documentation/`:
38+
39+
- **Purpose**: Keeps the staging environment in sync with the latest production-ready code from `main`
40+
- **Trigger**: Any push or merge to the `main` branch
41+
- **Deployment**: Same staging subdomain (`procore-staging.github.io`) as feature branch deployments
42+
- **Result**: Staging always reflects the current state of `main` branch
43+
44+
**Note**: This means `main` branch content will be available at `procore-staging.github.io/documentation/`, allowing you to test the latest production code in the staging environment before it goes to production.
45+
46+

_config_staging.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Staging configuration - extends _config.yml with staging-specific settings
2+
# Usage: bundle exec jekyll build --config _config.yml,_config_staging.yml
3+
#
4+
# For subdomain deployment (e.g., procore-staging.github.io):
5+
# - Create a separate repository named "procore-staging" (or similar)
6+
# - Deploy from that repository's main branch
7+
# - GitHub Pages will automatically serve it at procore-staging.github.io
8+
9+
baseurl: "/documentation" # Same baseurl as production (subdomain handles staging)
10+
url: "https://procore-staging.github.io" # Staging subdomain URL
11+

0 commit comments

Comments
 (0)