name: Deploy React Storybook

on: workflow_dispatch

jobs:
  upload:
    runs-on: ubuntu-latest

    if: "! contains(toJSON(github.event.commits.*.message), '[skip actions]')"

    steps:
      - name: Checkout repo
        uses: actions/checkout@v2
        with:
          ref: main
          token: ${{ secrets.GIT_HUB_TOKEN }}

      - name: Use Node.js v16
        uses: actions/setup-node@v2
        with:
          node-version: 16

      - name: Initialize
        run: make github-init

      - name: Deploy React Storybook
        uses: blocklet/action-workflow@v1
        with:
          skip-deps: true
          skip-bundle: false
          skip-upload: true
          skip-deploy: false
          skip-release: true
          deploy-app-did: z8ia1dodZ52VDmtfUkmUtDHpBjXcpqjrhyHfS
          deploy-mount-point: /playground/react
          bundle-command: npm run bundle
          working-directory: ux/react
          server-endpoint: ${{ secrets.XMARK_NODE_ENDPOINT }}
          server-access-key: ${{ secrets.XMARK_NODE_ACCESS_KEY }}
          server-access-secret: ${{ secrets.XMARK_NODE_ACCESS_SECRET }}
          slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
