From cebc800564af6f08cc4598b0b5816d003bed9b4a Mon Sep 17 00:00:00 2001 From: jackson Date: Fri, 21 Jun 2024 10:50:50 +0100 Subject: [PATCH] Actions --- .github/workflows/actions/action.yaml | 72 +++++++++++++++++++++++++++ .github/workflows/deploy.yaml | 2 +- 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/actions/action.yaml diff --git a/.github/workflows/actions/action.yaml b/.github/workflows/actions/action.yaml new file mode 100644 index 0000000..607c089 --- /dev/null +++ b/.github/workflows/actions/action.yaml @@ -0,0 +1,72 @@ +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: 'storybook-static' + install_yarn: + description: 'Install yarn.' + required: false + default: 'npm install -g yarn' + install_command: + description: 'Specifies the command to run the installation.' + required: false + default: 'yarn install --immutable --immutable-cache --check-cache' + build_command: + description: 'Specifies the command to run after npm ci for the build' + required: false + default: 'yarn build-storybook' +outputs: + page_url: + description: "The URL of the page" + value: ${{ steps.deploy.outputs.page_url }} + + + +runs: + using: 'ubuntu-latest' + steps: + - name: Checkout if required + if: ${{ inputs.checkout == 'true' }} + uses: actions/checkout@v4 + + - name: 'Build' + shell: bash + run: | + echo "::group::Build" + corepack enable + ${{ inputs.install_yarn }} + ${{ 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 + \ No newline at end of file diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 061c039..9061f7b 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -14,6 +14,6 @@ jobs: runs-on: ubuntu-latest steps: - id: build-publish - uses: bitovi/github-actions-storybook-to-github-pages@v1.0.3 + uses: actions/action with: path: build # change to your build folder