Skip to content

Commit

Permalink
ci: firebase config for storybook ui
Browse files Browse the repository at this point in the history
Adds a deploy workflow for the new storybook ui static site, deploying
to:

  * preview.ui.penumbra.zone, on merge to main
  * ui.penumbra.zone, on tag push

Additionally, PRs will have an ephemeral URL for preview posted to them
via a bot as a comment, so unmerged work can be viewed in an online
context.
  • Loading branch information
conorsch authored and jessepinho committed Jul 10, 2024
1 parent e481cea commit ed236ae
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/deploy-ui-preview-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Deploys the static website for the UI storybook to "preview" environment,
# on every merge into main branch.
name: Deploy UI to preview
on:
workflow_dispatch:
push:
branches:
- main
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- name: Install dependencies
run: pnpm install
working-directory: packages/ui

- name: Build static site
run: pnpm build-storybook
working-directory: packages/ui

- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_PENUMBRA_UI }}
channelId: live
target: preview
entryPoint: packages/ui
projectId: penumbra-ui
34 changes: 34 additions & 0 deletions .github/workflows/deploy-ui-preview-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Deploys the static website for the UI storybook to a temporary environment,
# with an ephemeral URL posted to the PR for sharing/review.
name: Deploy UI to temporary URL
on:
workflow_dispatch:
pull_request:
permissions:
checks: write
contents: read
pull-requests: write
jobs:
build_and_preview:
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- name: Install dependencies
run: pnpm install
working-directory: packages/ui

- name: Build static site
run: pnpm build-storybook
working-directory: packages/ui

- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_PENUMBRA_UI }}
target: preview
entryPoint: packages/ui
projectId: penumbra-ui
34 changes: 34 additions & 0 deletions .github/workflows/deploy-ui-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Deploys the static website for the UI storybook to final prod website,
# on every tag push into main branch.
name: Deploy UI to stable channel
on:
# Support ad-hoc runs
workflow_dispatch:
# Run automatically on tag push
push:
tags:
- '**[0-9]+.[0-9]+.[0-9]+*'
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- name: Install dependencies
run: pnpm install
working-directory: packages/ui

- name: Build static site
run: pnpm build-storybook
working-directory: packages/ui

- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_PENUMBRA_UI }}
channelId: live
target: stable
entryPoint: packages/ui
projectId: penumbra-ui
19 changes: 19 additions & 0 deletions packages/ui/.firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"projects": {
"default": "penumbra-ui"
},
"targets": {
"penumbra-ui": {
"hosting": {
"preview": [
"penumbra-ui-preview"
],
"stable": [
"penumbra-ui"
]
}
}
},
"etags": {},
"dataconnectEmulatorConfig": {}
}
22 changes: 22 additions & 0 deletions packages/ui/firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"hosting": [
{
"target": "preview",
"public": "storybook-static",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
},
{
"target": "stable",
"public": "storybook-static",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
]
}

0 comments on commit ed236ae

Please sign in to comment.