SubNav v2 #4228
Workflow file for this run
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
name: Deploy | |
on: | |
pull_request: | |
permissions: | |
checks: write | |
contents: read | |
deployments: write | |
pages: write | |
id-token: write | |
jobs: | |
deploy: | |
if: ${{ github.repository == 'primer/brand' }} | |
name: Preview | |
# SHA for security hardening. Points at last verified HEAD of main branch. | |
uses: primer/.github/.github/workflows/deploy_preview.yml@cd223835608ca5e9401e0ffe6081f6d2fcc912f3 | |
with: | |
node_version: 18 | |
install: npm ci --legacy-peer-deps && cd apps/docs && npm ci --legacy-peer-deps && cd .. | |
build: | | |
npm run build && \ | |
npm run build:docs && \ | |
npm run build:storybook && \ | |
mkdir brand-temp && \ | |
mv apps/docs/public/* brand-temp && \ | |
mv brand-temp apps/docs/public/brand && \ | |
# This is a client-side redirect that only applies to preview deployments. Workaround for lack of path prefixing. | |
echo '<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Redirecting...</title><script>window.location.href = "/brand";</script></head><body><p>If you are not redirected automatically, follow this <a href="/brand">link to /brand</a>.</p></body></html>' > apps/docs/public/index.html | |
output_dir: apps/docs/public | |
deploy-storybook: | |
if: ${{ github.repository == 'primer/brand' }} | |
name: Preview Storybook | |
runs-on: | |
labels: ubuntu-latest-16-cores | |
needs: deploy | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: chrnorm/deployment-action@v1.2.0 | |
name: Create GitHub deployment for storybook | |
id: storybook | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
environment: Preview Storybook | |
target_url: '${{ needs.deploy.outputs.deployment_url }}storybook' | |
- name: Update storybook deployment status (success) | |
if: success() | |
uses: chrnorm/deployment-status@v1.0.0 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
environment_url: '${{ needs.deploy.outputs.deployment_url }}storybook' | |
target_url: '${{ needs.deploy.outputs.deployment_url }}storybook' | |
state: 'success' | |
deployment_id: ${{ steps.storybook.outputs.deployment_id }} | |
- name: Update storybook deployment status (failure) | |
if: failure() | |
uses: chrnorm/deployment-status@v1.0.0 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
state: 'failure' | |
deployment_id: ${{ steps.storybook.outputs.deployment_id }} |