Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [22]

steps:
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build packages
run: npm run build

- name: Check types (common)
run: npx tsc --noEmit --project packages/common/tsconfig.json

- name: Check types (1_1)
run: npx tsc --noEmit --project packages/1_1/tsconfig.json

- name: Run tests
run: npm test --workspaces --if-present

- name: Check formatting
run: npx prettier --check .
64 changes: 64 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Publish Packages to npmjs

on:
push:
tags:
- 'v*.*.*'

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write # for creating github releases
id-token: write
environment: publish
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v5
with:
node-version: '22'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build packages
run: npm run build

- name: Extract version from tag
id: extract_version
run: |
tag="${GITHUB_REF#refs/tags/}"
version="${tag#v}"
echo "version=$version" >> $GITHUB_OUTPUT
echo "tag=$tag" >> $GITHUB_OUTPUT

- name: Update package versions
run: |
# Update version in all package.json files
npm version ${{ steps.extract_version.outputs.version }} --workspaces --no-git-tag-version
# Convert file dependencies to published versions for publishing
sed -i 's/"file:\.\.\/common"/"^${{ steps.extract_version.outputs.version }}"/g' packages/*/package.json

- name: Publish packages
run: |
npm publish --workspace=@json-feed-types/common --provenance --access public
npm publish --workspace=@json-feed-types/1_1 --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Create GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tag="${{ steps.extract_version.outputs.tag }}"

gh release create "$tag" \
--title="$tag" \
--draft \
--generate-notes
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ out
.nuxt
dist

# Package build output
packages/*/dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
Expand Down Expand Up @@ -155,3 +158,5 @@ dist
.webpack/

# End of https://www.toptal.com/developers/gitignore/api/node,macos

.rollup.cache
Loading