2021-09-07 14:00:44 +02:00
|
|
|
name: 'Storybook Deployment'
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
- main
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
storybook-deployment:
|
2023-06-08 01:14:58 +02:00
|
|
|
runs-on: ubuntu-latest
|
2021-10-25 23:59:31 +02:00
|
|
|
if: github.repository == 'PostHog/posthog'
|
2021-09-07 14:00:44 +02:00
|
|
|
steps:
|
|
|
|
- name: Check out PostHog/posthog repo
|
2022-10-26 20:40:00 +02:00
|
|
|
uses: actions/checkout@v3
|
2021-09-07 14:00:44 +02:00
|
|
|
with:
|
|
|
|
path: posthog
|
|
|
|
fetch-depth: 0
|
2021-10-14 20:03:47 +02:00
|
|
|
|
2022-12-12 10:28:06 +01:00
|
|
|
- name: Install pnpm
|
2024-05-20 22:03:04 +02:00
|
|
|
uses: pnpm/action-setup@v4
|
2024-05-23 09:43:18 +02:00
|
|
|
with:
|
|
|
|
package_json_file: posthog/package.json
|
2022-12-12 10:28:06 +01:00
|
|
|
|
2022-12-12 15:02:33 +01:00
|
|
|
- name: Set up Node.js
|
2024-03-11 17:07:43 +01:00
|
|
|
uses: actions/setup-node@v4
|
2022-12-12 10:28:06 +01:00
|
|
|
with:
|
2023-12-08 23:32:25 +01:00
|
|
|
node-version: 18.12.1
|
2022-12-12 10:28:06 +01:00
|
|
|
cache: pnpm
|
|
|
|
cache-dependency-path: posthog/pnpm-lock.yaml
|
|
|
|
|
|
|
|
- name: Install dependencies (pnpm)
|
|
|
|
run: cd posthog && pnpm i
|
2021-10-14 20:03:47 +02:00
|
|
|
|
2021-09-07 14:00:44 +02:00
|
|
|
- name: Build storybook
|
2022-12-12 10:28:06 +01:00
|
|
|
run: cd posthog && pnpm build-storybook
|
2021-10-14 20:03:47 +02:00
|
|
|
|
2021-09-07 14:00:44 +02:00
|
|
|
- name: Check out PostHog/storybook-build repo
|
2022-10-26 20:40:00 +02:00
|
|
|
uses: actions/checkout@v3
|
2021-09-07 14:00:44 +02:00
|
|
|
with:
|
|
|
|
path: storybook-build
|
|
|
|
repository: PostHog/storybook-build
|
|
|
|
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}
|
2021-10-14 20:03:47 +02:00
|
|
|
|
2021-09-07 14:00:44 +02:00
|
|
|
- name: Copy built changes to PostHog/storybook-build repo
|
|
|
|
run: |
|
|
|
|
# keep the CNAME file, but discard all the rest
|
|
|
|
cp storybook-build/docs/CNAME posthog/storybook-static/
|
|
|
|
rm -rf storybook-build/docs
|
|
|
|
cp -a posthog/storybook-static storybook-build/docs
|
2021-10-14 20:03:47 +02:00
|
|
|
|
2023-01-12 15:01:49 +01:00
|
|
|
- name: Set commit message
|
|
|
|
id: commit-message
|
|
|
|
run: echo "msg=Storybook build for ${{ github.sha }}" >> $GITHUB_OUTPUT
|
|
|
|
|
2021-09-07 14:00:44 +02:00
|
|
|
- name: Commit update
|
2024-01-23 14:13:50 +01:00
|
|
|
uses: stefanzweifel/git-auto-commit-action@v5
|
2021-09-07 14:00:44 +02:00
|
|
|
with:
|
|
|
|
repository: storybook-build
|
2023-01-12 15:01:49 +01:00
|
|
|
commit_message: ${{ steps.commit-message.outputs.msg }}
|
2021-09-07 14:00:44 +02:00
|
|
|
commit_user_name: PostHog Bot
|
|
|
|
commit_user_email: hey@posthog.com
|
|
|
|
commit_author: PostHog Bot <hey@posthog.com>
|