Skip to content

Commit

Permalink
Run the storybook and headless-lms-docs actions on pull requests
Browse files Browse the repository at this point in the history
  • Loading branch information
nygrenh committed Sep 11, 2023
1 parent 60a1de9 commit 0b110d9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/headless-lms-doc.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
name: Build and deploy headless-lms docs
name: headless-lms docs

on:
push:
branches:
- master
pull_request:
branches:
- master

concurrency:
# New commits cancel previous builds only on pull requests. This is because `github.head_ref`` is only set on pull requests and `github.sha`` is unique for each commit.
group: headless-lms-doc-${{ github.head_ref || github.sha }}
cancel-in-progress: true


jobs:
build-and-deploy:
Expand Down Expand Up @@ -35,3 +44,4 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: services/headless-lms/target/doc
if: ${{ github.ref == 'refs/heads/master' }}
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
name: Generate storybook
name: Storybook

on:
push:
branches:
- master
pull_request:
branches:
- master

concurrency:
# New commits cancel previous builds only on pull requests. This is because `github.head_ref`` is only set on pull requests and `github.sha`` is unique for each commit.
group: storybook-${{ github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
generate-storybook:
Expand All @@ -24,10 +32,12 @@ jobs:
ls -la ~/.ssh
env:
STORYBOOK_DEPLOY_KEY: ${{ secrets.STORYBOOK_DEPLOY_KEY }}
if: ${{ github.ref == 'refs/heads/master' }}
- name: Check out storybook repository
run: git clone --branch gh-pages [email protected]:rage/secret-project-storybook.git ./shared-module/storybook-static-repo
env:
GIT_SSH_COMMAND: "ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_ed25519 -o IdentitiesOnly=yes"
if: ${{ github.ref == 'refs/heads/master' }}

- name: npm ci
run: npm ci
Expand All @@ -39,9 +49,11 @@ jobs:

- name: Remove old files from repo
run: rm -rf ./shared-module/storybook-static-repo/*
if: ${{ github.ref == 'refs/heads/master' }}

- name: Copy new files to repo
run: cp -r ./shared-module/storybook-static/* ./shared-module/storybook-static-repo/
if: ${{ github.ref == 'refs/heads/master' }}

- name: Commit files
run: |
Expand All @@ -50,9 +62,11 @@ jobs:
git add .
git commit -m "Update: $GITHUB_SHA" --allow-empty
working-directory: ./shared-module/storybook-static-repo
if: ${{ github.ref == 'refs/heads/master' }}

- name: Push changes
run: git push
env:
GIT_SSH_COMMAND: "ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_ed25519 -o IdentitiesOnly=yes"
working-directory: ./shared-module/storybook-static-repo
if: ${{ github.ref == 'refs/heads/master' }}

0 comments on commit 0b110d9

Please sign in to comment.