Skip to content
This repository has been archived by the owner on Aug 13, 2023. It is now read-only.

Commit

Permalink
Merge branch 'latest' into migrate-to-yarn
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Roebuck authored Feb 12, 2021
2 parents b3cdad1 + 77f9a9a commit 041ef8f
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/psammead-storybook-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Deploy Storybook Preview

on:
pull_request:
branches:
- '**'

jobs:
deploy-storybook-preview:
name: Deploy Storybook Preview
runs-on: ubuntu-latest
env:
BUCKET_DIR: ${{github.event.number}}
PREVIEW_URL: 'http://psammead-preview.tools.bbc.co.uk/${{github.event.number}}'

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
persist-credentials: false

- name: Install Node Modules and Build
if: github.event.pull_request.closed != true # Run this step for all PR events except `closed`
run: |
npm run ci:packages
npm run build:storybook
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.STORYBOOK_PREVIEW_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.STORYBOOK_PREVIEW_AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-1

- name: 'Deploy storybook to preview environment'
if: github.event.pull_request.closed != true # Run this step for all PR events except `closed`
run: |
aws s3 sync storybook_dist ${{ secrets.STORYBOOK_PREVIEW_S3_BUCKET }}${{ env.BUCKET_DIR }} --acl public-read
- name: Comment on PR with preview URL
if: github.event.pull_request.closed != true # Run this step for all PR events except `closed`
uses: unsplash/comment-on-pr@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
msg: Checkout your storybook preview here ${{ env.PREVIEW_URL }}
check_for_duplicate_msg: true

- name: 'Cleaning up storybook preview for PR#${{ env.BUCKET_DIR }}'
if: github.event.pull_request.closed == true # Only run this step when the PR is closed
run: |
aws s3 rm ${{ secrets.STORYBOOK_PREVIEW_S3_BUCKET }}${{ env.BUCKET_DIR }} --recursive

0 comments on commit 041ef8f

Please sign in to comment.