-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #698 from GSA/pr-branches
Add workflows to deploy PR branches
- Loading branch information
Showing
3 changed files
with
77 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,25 +4,26 @@ on: | |
branches: | ||
- master | ||
jobs: | ||
Build-And-Deploy: | ||
Build-Storybook: | ||
uses: ./.github/workflows/build.yml | ||
Deploy-Storybook: | ||
runs-on: ubuntu-latest | ||
if: ${{ success() }} | ||
needs: Build-Storybook | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v2 | ||
- name: Setup Node | ||
uses: actions/setup-node@v1 | ||
- name: Download Storybook Assets | ||
# If closing PR, build will not occur so nothing to download | ||
if: github.event.action != 'closed' | ||
uses: actions/download-artifact@v4 | ||
with: | ||
node-version: '18.x' | ||
- name: Install Node Packages | ||
run: npm i | ||
- name: Build Storybook Assets | ||
env: | ||
NODE_OPTIONS: "--max_old_space_size=8192" | ||
run: npm run build:storybook | ||
- name: Add .nojekyll file to allow for node_modules to be included in bundle | ||
run: touch _site/.nojekyll | ||
name: storybook-assets | ||
path: ./_site | ||
- name: Deploy 🚀 | ||
uses: JamesIves/[email protected] | ||
with: | ||
branch: gh-pages | ||
folder: _site | ||
clean-exclude: pr-preview/ | ||
force: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Build Storybook | ||
on: | ||
workflow_call: | ||
inputs: | ||
pr-number: | ||
required: false | ||
type: string | ||
jobs: | ||
Build-Storybook-Assets: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v4 | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '18.x' | ||
- name: Install Node Packages | ||
run: npm i | ||
- name: Build Storybook Assets | ||
run: npm run build:storybook | ||
env: | ||
NODE_OPTIONS: "--max_old_space_size=8192" | ||
- name: Add .nojekyll file to allow for node_modules to be included in bundle | ||
run: touch _site/.nojekyll | ||
- name: Archive Storybook Assets | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: storybook-assets | ||
path: _site | ||
retention-days: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Deploy PRs | ||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
- closed | ||
jobs: | ||
Build-Storybook: | ||
if: github.event.action != 'closed' | ||
uses: ./.github/workflows/build.yml | ||
with: | ||
pr-number: ${{ github.event.number }} | ||
Deploy-Storybook: | ||
runs-on: ubuntu-latest | ||
if: ${{ !failure() }} | ||
needs: Build-Storybook | ||
steps: | ||
# Only needed because rossjrw/pr-preview-action needs to run in a git repo | ||
- name: Check out repository code | ||
uses: actions/checkout@v4 | ||
- name: Download Storybook Assets | ||
# If closing PR, build will not occur so nothing to download | ||
if: github.event.action != 'closed' | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: storybook-assets | ||
path: ./_site | ||
- name: Deploy preview | ||
uses: rossjrw/pr-preview-action@v1 | ||
with: | ||
source-dir: ./_site/ |