Skip to content

Merge pull request #36 from Johnsoct/typography-presentation #67

Merge pull request #36 from Johnsoct/typography-presentation

Merge pull request #36 from Johnsoct/typography-presentation #67

name: Build and test publish Core-CSS
on:
push
jobs:
build:
name: Build dist/lib/
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: Setup Node.js
id: setup-node
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Install dependencies
id: install
run: npm ci
- name: Build dist/lib/ directory
id: build
run: npm run lib:build
# This will fail the workflow if the `dist/lib/` directory is different than
# expected.
- name: Compare Directories
id: diff
run: |
if [ ! -d dist/lib/ ]; then
echo "Expected dist/lib/ directory does not exist. See status below:"
ls -la ./
exit 1
fi
if [ "$(git diff --ignore-space-at-eol --text dist/lib/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff --ignore-space-at-eol --text dist/lib/
exit 1
fi
# If `dist/lib/` was different than expected, upload the expected version as a
# workflow artifact.
- if: ${{ failure() && steps.diff.outcome == 'failure' }}
name: Upload Artifact
id: upload
uses: actions/upload-artifact@v4
with:
name: lib
path: dist/lib
publish:
needs: build
name: Publish package
runs-on: ubuntu-latest
permissions:
contents: read
# required for --provenance
id-token: write
steps:
- uses: actions/checkout@v4
# Setup .npmrc to publish to GitHub Packages
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies via package-lock.json
run: npm ci --loglevel verbose
- name: Test publish to NPM
run: npm publish --dry-run
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}