Skip to content

Commit

Permalink
Update github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
majakomel committed Oct 12, 2023
1 parent ed44e2c commit c1b1004
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions .github/workflows/storybook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: Storybook
on:
push:
branches:
- dev
- master
# Only run if relevant files changed.
paths:
Expand Down Expand Up @@ -82,25 +81,34 @@ jobs:
id: branch-target
if: github.event_name != 'pull_request'
run: echo "dir=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT
- name: Set PR environment variables
- name: Deploy PR
id: pr-target
if: github.event_name == 'pull_request'
env:
PULL_REQUEST_NUMBER: ${{ github.event.number }}
run: echo "dir=pr/${PULL_REQUEST_NUMBER}" >> $GITHUB_OUTPUT
- name: Commit updates
run: |
mkdir -p /${TARGET_DIR}
rm -rf /${TARGET_DIR}
mv dist /${TARGET_DIR}
echo "dir=pr/${PULL_REQUEST_NUMBER}" >> $GITHUB_OUTPUT
mkdir -p ${TARGET_DIR}
rm -rf ${TARGET_DIR}
mv storybook-static ${TARGET_DIR}
git add .
git status
git diff --staged --quiet && echo 'No changes to commit; exiting!' && exit 0
git pull --no-edit --quiet
git commit -m "Deploy storybook for ${TARGET_DIR}."
git push origin gh-pages
env:
PULL_REQUEST_NUMBER: ${{ github.event.number }}
TARGET_DIR: ${{ steps.pr-target.outputs.dir }}
# - name: Deploy master
# if: github.event_name == 'push'
# run: |
# find -mindepth 1 -delete
# mv storybook-static .
# git add .
# git status
# git diff --staged --quiet && echo 'No changes to commit; exiting!' && exit 0
# git pull --no-edit --quiet
# git commit -m "Deploy storybook for ${TARGET_DIR}."
# git push origin gh-pages

remove-storybook:
name: Remove Storybook
Expand Down

0 comments on commit c1b1004

Please sign in to comment.