Completion requirements by chapter #452
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v2 | |
- name: Set up deploy key | |
run: | | |
mkdir -p ~/.ssh | |
echo "$STORYBOOK_DEPLOY_KEY" > ~/.ssh/id_ed25519 | |
chmod 600 ~/.ssh/id_ed25519 | |
md5sum ~/.ssh/id_ed25519 | |
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 git@github.com:rage/secret-project-storybook.git ./storybook/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 for the repo root | |
run: npm ci | |
- name: npm ci for the storybook | |
run: npm ci | |
working-directory: ./storybook | |
- name: npm run build-storybook | |
run: npm run build-storybook -- --quiet | |
working-directory: ./storybook | |
- name: Remove old files from repo | |
run: rm -rf ./storybook/storybook-static-repo/* | |
if: ${{ github.ref == 'refs/heads/master' }} | |
- name: Copy new files to repo | |
run: cp -r ./storybook/storybook-static/* ./storybook/storybook-static-repo/ | |
if: ${{ github.ref == 'refs/heads/master' }} | |
- name: Commit files | |
run: | | |
git config --local user.email "bot@example.com" | |
git config --local user.name "github-actions[bot]" | |
git add . | |
git commit -m "Update: $GITHUB_SHA" --allow-empty | |
working-directory: ./storybook/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: ./storybook/storybook-static-repo | |
if: ${{ github.ref == 'refs/heads/master' }} |