DM-40259: Update storybook to v7 and adopt pnpm #577
Workflow file for this run
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: CI | |
'on': | |
push: | |
branches-ignore: | |
# These should always correspond to pull requests, so ignore them for | |
# the push trigger and let them be triggered by the pull_request | |
# trigger, avoiding running the workflow twice. This is a minor | |
# optimization so there's no need to ensure this is comprehensive. | |
- 'dependabot/**' | |
- 'renovate/**' | |
- 'tickets/**' | |
- 'u/**' | |
tags: | |
- '*' | |
pull_request: {} | |
jobs: | |
changes: | |
runs-on: ubuntu-latest | |
# Set job outputs to values from filter step | |
outputs: | |
docs: ${{ steps.filter.outputs.docs }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dorny/paths-filter@v2 | |
id: filter | |
with: | |
filters: | | |
docs: | |
- 'docs/**' | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Read .nvmrc | |
id: node_version | |
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc) | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Authenticate GitHub Packages | |
run: | | |
echo "//npm.pkg.github.com/:_authToken=${NPM_PKG_TOKEN}" > ~/.npmrc | |
env: | |
NPM_PKG_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ steps.node_version.outputs.NODE_VERSION }} | |
cache: 'pnpm' | |
- name: Install npm packages | |
run: pnpm install | |
- name: Lint | |
run: | | |
pnpm run lint | |
pnpm run format:check | |
- name: Build site | |
run: pnpm run build | |
docker: | |
needs: | |
- test | |
if: > | |
startsWith(github.ref, 'refs/tags/') || startsWith(github.head_ref, 'tickets/') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Define the Docker tag | |
id: vars | |
run: echo ::set-output name=tag::$(.github/docker-tag.sh) | |
- name: Print the tag | |
id: print | |
run: echo ${{steps.vars.outputs.tag}} | |
- name: Set up Docker buildx | |
uses: docker/setup-buildx-action@v2 | |
id: builder | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
# Only push tags or ticket branches | |
push: true | |
tags: | | |
ghcr.io/lsst-sqre/squareone:${{ steps.vars.outputs.tag }} | |
target: production | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-args: | | |
GH_PKG_TOKEN=${{ secrets.GITHUB_TOKEN }} | |
docs: | |
needs: [changes] | |
if: ${{ needs.changes.outputs.docs == 'true' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools | |
pip install -r docs/requirements.txt | |
- name: Build documentation | |
working-directory: docs | |
run: make html | |
- name: Upload documentation | |
uses: lsst-sqre/ltd-upload@v1 | |
with: | |
project: 'squareone' | |
dir: 'docs/_build/html' | |
username: ${{ secrets.LTD_USERNAME }} | |
password: ${{ secrets.LTD_PASSWORD }} |