Skip to content

Commit

Permalink
Merge pull request #1030 from preactjs/ci
Browse files Browse the repository at this point in the history
CI: Add build pipeline
  • Loading branch information
rschristian authored Nov 30, 2023
2 parents b5b2dc2 + 18035f4 commit c49e4b6
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- run: npm ci
- run: npm run build
env:
NODE_OPTIONS: '--openssl-legacy-provider'
7 changes: 6 additions & 1 deletion preact.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ export default function (config, env, helpers) {
const matches = content.match(FRONT_MATTER_REG);
if (!matches) return content;

const meta = yaml.parse('---\n' + matches[1].replace(/^/gm, ' ') + '\n') || {};
let meta;
try {
meta = yaml.parse('---\n' + matches[1].replace(/^/gm, ' ') + '\n') || {};
} catch (e) {
throw new Error(`Error parsing YAML FrontMatter in ${path}`);
}
content = content.replace(FRONT_MATTER_REG, '');
if (!meta.title) {
let [, title] = content.match(TITLE_REG) || [];
Expand Down

0 comments on commit c49e4b6

Please sign in to comment.