Skip to content

Commit

Permalink
refactor: add deploy-storybook action
Browse files Browse the repository at this point in the history
  • Loading branch information
itsjavi committed Aug 31, 2024
1 parent bcbce75 commit 6f7c3bb
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 1 deletion.
65 changes: 65 additions & 0 deletions .github/actions/deploy-storybook/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: 'Deploy Storybook to GitHub Pages'
description: 'Build and deploy storybook code to GitHub pages'
branding:
icon: upload-cloud
color: red
inputs:
checkout:
description: 'Specifies if this action should checkout the code'
required: false
default: 'true'
path:
description: 'Specifies the path of the static assets after building'
required: false
# TODO: where does storybook output by default?
default: 'dist/storybook'
install_command:
description: 'Specifies the command to run the installation.'
required: false
default: 'npm ci'
build_command:
description: 'Specifies the command to run after npm ci for the build'
required: false
default: 'npm run build-storybook'
outputs:
page_url:
description: "The URL of the page"
value: ${{ steps.deploy.outputs.page_url }}

runs:
using: 'composite'

steps:
- name: Checkout if required
if: ${{ inputs.checkout == 'true' }}
uses: actions/checkout@v4

- name: 'Build'
shell: bash
run: |
echo "::group::Build"
${{ inputs.install_command }}
${{ inputs.build_command }}
echo "::endgroup::"
- name: 'upload'
uses: actions/upload-pages-artifact@v3
with:
path: ${{ inputs.path }}

- id: deploy
name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4
with:
token: ${{ github.token }}

# - name: Print footer
# shell: bash
# run: |
# echo "" >> $GITHUB_STEP_SUMMARY
# echo "# Made by [![Bitovi](https://www.bitovi.com/hubfs/limbo-generated/imgs/logos/bitovi-logo-23.svg)](https://bitovi.com)" >> $GITHUB_STEP_SUMMARY
# echo "" >> $GITHUB_STEP_SUMMARY
# echo "Check the rest of our actions in the [GitHub Marketplace](https://github.com/marketplace?category=&type=actions&verification=&query=bitovi)!" >> $GITHUB_STEP_SUMMARY
# echo "" >> $GITHUB_STEP_SUMMARY
# echo "You can get help or ask questions on our [Discord Channel](https://discord.gg/zAHn4JBVcX), or set up a free consultation on our [platform engineering website](https://www.bitovi.com/services/devops-consulting/platform-engineering)." >> $GITHUB_STEP_SUMMARY

2 changes: 1 addition & 1 deletion .github/workflows/publish-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
- name: "Build storybook"
run: pnpm build:storybook

- uses: bitovi/github-actions-storybook[email protected]
- uses: ./.github/actions/deploy-storybook
with:
install_command: pnpm install # default: npm ci
build_command: pnpm build:storybook # default: npm run build-storybook
Expand Down

0 comments on commit 6f7c3bb

Please sign in to comment.