Skip to content

Adjusting outline-docs package so projects can use them #1069

Adjusting outline-docs package so projects can use them

Adjusting outline-docs package so projects can use them #1069

Workflow file for this run

# Build Workflows for Outline.js
name: Outline Core Build
# Controls when the action will run. Triggers the workflow on push or pull request
on:
# Which branches to test on push/merge.
push:
branches:
- release
- main
- next
- dev
- alpha
- beta
- rc
# Which branches to test on pull request.
pull_request:
branches:
- release
- main
- next
- dev
- alpha
- beta
- rc
- /^issue/
- /^task/
- /^feature/
- /^bug/
- /^test/
# The jobs for the build workflow.
jobs:
# Basic setup job to prepare codebase.
setup:
name: Install Codebase
runs-on: ubuntu-latest
strategy:
matrix:
# The node versions to test against.
node: [ 16, 18 ]
# The steps for the setup job.
steps:
# @see https://github.com/marketplace/actions/checkout
- name: Checkout Codebase
uses: actions/checkout@v3
# @see https://github.com/marketplace/actions/setup-node-js-environment
- uses: actions/setup-node@v3
with:
# The node version to use.
node-version: ${{ matrix.node }}
cache: 'yarn'
# The registry to use by default for package publishing.
registry-url: 'https://npm.pkg.github.com'
# Defaults to the user or organization that owns the workflow file
scope: '@phase2'
# @see https://github.com/marketplace/actions/cache
# node_modules caching is validated by always running yarn install.
# Turborepo cache lives inside node_modules/.cache/turbo
- uses: actions/cache@v3
id: yarn-cache
with:
path: |
node_modules
storybook-static
key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.node }}-yarn-
- name: Initialize .npmrc
run: cp $NPM_CONFIG_USERCONFIG .npmrc
- name: Install
run: yarn install --check-cache
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_GITHUB_PACKAGES }}
- name: Build Outline
run: yarn build --force
- name: Build Storybook
run: yarn storybook:build
# Job to run build, and basic assurances the codebase is ready for additional processing.
build:
name: Build Codebase
runs-on: ubuntu-latest
needs: ['setup']
strategy:
matrix:
node: [ 16, 18 ]
# The steps for the setup job.
steps:
# @see https://github.com/marketplace/actions/checkout
- name: Checkout Codebase
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'yarn'
# @see https://github.com/marketplace/actions/cache
# node_modules caching is validated by always running yarn install.
# Turborepo cache lives inside node_modules/.cache/turbo
- uses: actions/cache@v3
id: yarn-cache
with:
path: |
node_modules
storybook-static
key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.node }}-yarn-
- name: Install
run: yarn install --prefer-offline
- name: Build from cache
run: yarn build
- name: Build Storybook
run: yarn storybook:build
# Job to run package publishing process.
test:
name: Test Codebase
runs-on: ubuntu-latest
needs: ['setup']
strategy:
matrix:
node: [ 16, 18 ]
# The steps for the setup job.
steps:
# @see https://github.com/marketplace/actions/checkout
- name: Checkout Codebase
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'yarn'
# @see https://github.com/marketplace/actions/cache
# node_modules caching is validated by always running yarn install.
# Turborepo cache lives inside node_modules/.cache/turbo
- uses: actions/cache@v3
id: yarn-cache
with:
path: |
node_modules
storybook-static
key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.node }}-yarn-
- name: Install
run: yarn install --prefer-offline
- name: Build Outline
run: yarn build
- name: Run eslint
run: yarn lint:eslint
- name: Run prettier
run: yarn lint:prettier
- name: Build Storybook
run: yarn storybook:build
# Basic setup job to prepare codebase.
deploy-github-pages:
name: "Publish: GitHub Pages"
if: github.ref == 'refs/heads/next'
runs-on: ubuntu-latest
needs: ['setup', 'build', 'test']
# The steps for the setup job.
steps:
# @see https://github.com/marketplace/actions/checkout
- name: Checkout codebase
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'yarn'
# @see https://github.com/marketplace/actions/cache
# node_modules caching is validated by always running yarn install.
# Turborepo cache lives inside node_modules/.cache/turbo
- uses: actions/cache@v3
id: yarn-cache
with:
path: |
node_modules
storybook-static
key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.node }}-yarn-
- name: Install
run: yarn install --prefer-offline
- name: Build Outline
run: yarn build
- name: Build Storybook
run: yarn storybook:build
- name: Check GitHub Pages status
uses: crazy-max/ghaction-github-status@v3
with:
pages_threshold: major_outage
- name: Deploy to GitHub Pages
if: success()
uses: crazy-max/ghaction-github-pages@v3
with:
target_branch: gh-pages
build_dir: storybook-static
commit_message: 'chore(deploy): Storybook'
keep_history: false
jekyll: false
fqdn: outline.phase2tech.com
env:
GITHUB_TOKEN: ${{ secrets.NPM_GITHUB_PACKAGES }}
# @see https://github.com/marketplace/actions/upload-a-build-artifact
- name: Upload Storybook artifact
uses: actions/upload-artifact@v3
with:
name: storybook-latest
path: storybook-static/
retention-days: 1
# Job to run package publishing process.
# This should ONLY be ran on on branches where
deploy-github-packages:
name: "Publish: GitHub Packages"
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/release'
needs: ['setup', 'build', 'test']
# The steps for the build job.
steps:
# @see https://github.com/marketplace/actions/checkout
- name: Checkout codebase
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: 'https://npm.pkg.github.com'
# Defaults to the user or organization that owns the workflow file
scope: '@phase2'
cache: 'yarn'
# @see https://github.com/marketplace/actions/cache
# node_modules caching is validated by always running yarn install.
# Turborepo cache lives inside node_modules/.cache/turbo
- uses: actions/cache@v3
id: yarn-cache
with:
path: |
node_modules
storybook-static
key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.node }}-yarn-
- name: Install
run: yarn install --prefer-offline
- name: Build Outline
run: yarn build
- name: Manage Changesets
id: changesets
uses: changesets/action@v1
env:
GITHUB_TOKEN: ${{ secrets.NPM_GITHUB_PACKAGES }}
- name: Publish
if: steps.changesets.outputs.hasChangesets == 'false'
# You can do something when a publish should happen.
run: yarn changeset publish
# Job to run package publishing process.
# This should ONLY be ran on on branches where
deploy-npm-packages:
name: "Publish: NPM Packages"
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/release'
needs: ['setup', 'build', 'test']
# The steps for the build job.
steps:
# @see https://github.com/marketplace/actions/checkout
- name: Checkout codebase
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: 'https://registry.npmjs.org/'
# Defaults to the user or organization that owns the workflow file
scope: '@phase2'
cache: 'yarn'
# @see https://github.com/marketplace/actions/cache
# node_modules caching is validated by always running yarn install.
# Turborepo cache lives inside node_modules/.cache/turbo
- uses: actions/cache@v3
id: yarn-cache
with:
path: |
node_modules
storybook-static
key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.node }}-yarn-
- name: Install
run: yarn install --prefer-offline
- name: Build Outline
run: yarn build
- name: Manage Changesets
id: changesets
uses: changesets/action@v1
env:
GITHUB_TOKEN: ${{ secrets.NPM_NPM_PACKAGES }}
- name: Publish
if: steps.changesets.outputs.hasChangesets == 'false'
# You can do something when a publish should happen.
run: yarn changeset publish
chromatic-deployment:
name: "Publish: Chromatic"
runs-on: ubuntu-latest
needs: ['setup', 'build', 'test']
steps:
# @see https://github.com/marketplace/actions/checkout
- name: Checkout codebase
uses: actions/checkout@v3
with:
fetch-depth: 0 # 👈 Required to retrieve git history
- uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'yarn'
# @see https://github.com/marketplace/actions/cache
# node_modules caching is validated by always running yarn install.
# Turborepo cache lives inside node_modules/.cache/turbo
- uses: actions/cache@v3
id: yarn-cache
with:
path: |
node_modules
storybook-static
key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.node }}-yarn-
- name: Install
run: yarn install --prefer-offline
- name: Build Outline
run: yarn build
- name: Build Storybook
run: yarn storybook:build
- name: Publish to Chromatic
uses: chromaui/action@v1
# Required options for the Chromatic GitHub Action
with:
# 👇 Chromatic projectToken, refer to the manage page to obtain it.
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
buildScriptName: storybook:build
autoAcceptChanges: true # 👈 Option to accept all changes