build-docs #2412
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: build-docs | |
on: | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: "Upstream sha to build" | |
required: false | |
default: "dev" | |
type: "string" | |
jobs: | |
build-docs: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout design-system repository | |
uses: actions/checkout@v2 | |
with: | |
# full history required | |
fetch-depth: 0 | |
ref: ${{ github.ref }} | |
- name: Clone core and build storybook | |
env: | |
REMOTE_REF: ${{ inputs.ref }} | |
SSH_KEY: ${{ secrets.OPENPROJECT_CI_SSH_KEY }} | |
run: | | |
# Setup git to be able to clone and merge | |
git config --global user.name "OpenProject CI" | |
git config --global user.email "[email protected]" | |
mkdir -p ~/.ssh && chmod 0700 ~/.ssh | |
echo "$SSH_KEY" > ~/.ssh/id_rsa && chmod 0600 ~/.ssh/id_rsa | |
# Clone the repository and checkout the right branch | |
REF=${REMOTE_REF/refs\/heads\//} | |
echo "Checking out $REF from the github.com/opf/openproject repository" | |
git clone --single-branch -b "$REF" https://github.com/opf/openproject core | |
# Add CORE_VERSION file | |
cd core | |
TZ=UTC git log "$REF" --pretty=format:'%h (%cd)%n' --date=iso-local -n 1 > ../config/CORE_VERSION | |
cd ../ | |
git add ./config/CORE_VERSION | |
# Install dependencies and build storybook | |
cd core/frontend | |
npm ci | |
touch ./src/app/features/plugins/linked-plugins.styles.sass | |
cp ./src/app/features/plugins/linked-plugins.module.ts.example \ | |
./src/app/features/plugins/linked-plugins.module.ts | |
npm run storybook:build | |
cd ../../ | |
# Copy the static files over and commit them | |
rm -rf ./docs | |
cp -r core/frontend/storybook-static ./docs | |
git add ./docs | |
DATE=$(date) | |
git commit -m "[$DATE] Latest storybook from $REF" | |
git push |