Skip to content

Commit

Permalink
add preview deployment for forks
Browse files Browse the repository at this point in the history
  • Loading branch information
rezrah committed Jan 26, 2024
1 parent e6228e6 commit 42a6773
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/deploy_docs_preview_forks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Deploy

on:
pull_request_target:

permissions:
checks: write
contents: read
deployments: write
pages: write
id-token: write

jobs:
deploy:
if: ${{ github.repository != github.event.pull_request.head.repo.full_name }}
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: 16
install: npm ci --legacy-peer-deps && cd apps/docs && npm ci --legacy-peer-deps && cd ..
build: npm run build && npm run build:docs:preview && npm run build:storybook:preview
output_dir: apps/docs/public/

deploy-storybook:
if: ${{ github.repository != github.event.pull_request.head.repo.full_name }}
name: Preview Storybook
runs-on:
labels: ubuntu-latest-16-cores
needs: deploy
steps:
- uses: actions/checkout@v3

- uses: chrnorm/[email protected]
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/[email protected]
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/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
state: 'failure'
deployment_id: ${{ steps.storybook.outputs.deployment_id }}

0 comments on commit 42a6773

Please sign in to comment.