Skip to content

Commit

Permalink
feat(workflows): Storybook pr preview on github pages (#183)
Browse files Browse the repository at this point in the history
* correct runs-on target

* renamings

* preview storybook PRs

* trigger changes on ui-components

* just trigger if ui-componets have changed

* test new colors in pr preview

* fix file colors

* revert changes. There were just to check.

* ignore checks or deploy PRs if just markdown files are touched

* add new line

* do not run checks for github checks

* remove test

* add colons

* add new line

* move this change to a different pr

* ignore github after changing settings

* move to another pr
  • Loading branch information
ArtieReus authored Aug 7, 2024
1 parent a3f71ba commit 14a6a0f
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 10 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:

jobs:
install-dependencies:
runs-on: ubuntu-latest
runs-on: [default]
steps:
- uses: actions/checkout@v4
- name: Use Node.js
Expand All @@ -34,7 +34,7 @@ jobs:
run: npm ci

reuse-compliance:
runs-on: [ubuntu-latest]
runs-on: [default]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -44,7 +44,7 @@ jobs:
uses: fsfe/reuse-action@v3

license-headers:
runs-on: [ubuntu-latest]
runs-on: [default]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -61,7 +61,7 @@ jobs:

allowed-licenses:
needs: install-dependencies
runs-on: ubuntu-latest
runs-on: [default]
steps:
- uses: actions/checkout@v4
- name: Use Node.js
Expand All @@ -85,7 +85,7 @@ jobs:

lint:
needs: install-dependencies
runs-on: ubuntu-latest
runs-on: [default]
steps:
- uses: actions/checkout@v4
- name: Use Node.js
Expand All @@ -108,7 +108,7 @@ jobs:

format:
needs: install-dependencies
runs-on: ubuntu-latest
runs-on: [default]
steps:
- uses: actions/checkout@v4
- name: Use Node.js
Expand All @@ -131,7 +131,7 @@ jobs:

test:
needs: install-dependencies
runs-on: ubuntu-latest
runs-on: [default]
steps:
- uses: actions/checkout@v4
- name: Use Node.js
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy-github-pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# `{"pull_request": {"number": <PR number>, "head": {"ref": "<PR branch name>", "sha": "PR commit sha"}, "base": {"ref": "main"}}, "repository": {"name": "juno", "owner": {"login": "cloudoperators"}}}`
# 2. Run the following command:
# `act push --container-architecture linux/amd64 -P default=catthehacker/ubuntu:act-latest -e act_push.json -W .github/workflows/deploy-github-pages.yaml`
name: Storybook
name: Storybook to GitHub Pages

on:
push:
Expand All @@ -24,7 +24,7 @@ permissions:

jobs:
build-and-deploy:
concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession.
concurrency: deploy-gh-pages-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession.
runs-on: [default]
steps:
- uses: actions/checkout@v4
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/deploy-pr-preview.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Storybook PR Preview

on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed
paths:
- "packages/ui-components/**"
# The paths-ignore option only prevents the workflow from running if all the changed files match the ignore patterns
paths-ignore:
- '**.md'

# Limit the concurrency of entire workflow
concurrency: deploy-pr-preview-${{ github.ref }}

jobs:
deploy-preview:
runs-on: [default]
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: "20.x"

- name: Install dependencies
if: github.event.action != 'closed'
run: |
npm install --force
- name: Build storybook
run: npm -w @cloudoperators/juno-ui-components run build-storybook

- uses: rossjrw/pr-preview-action@v1
with:
source-dir: packages/ui-components/storybook-static
preview-branch: gh-pages
umbrella-dir: pr-preview
action: auto
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ permissions:
jobs:
release:
name: Release
runs-on: ubuntu-latest
runs-on: [default]
steps:
- name: Checkout Repo
uses: actions/checkout@v3
Expand Down

0 comments on commit 14a6a0f

Please sign in to comment.