Skip to content
Closed
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
54 changes: 37 additions & 17 deletions .github/workflows/ci.yml → .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
name: CI
name: PR Merge Check - Codeoid

on:
push:
branches: [main]
pull_request:
branches: [main]
types:
- opened
- synchronize
- reopened
branches:
- "main"
merge_group:
types:
- checks_requested

# Cancel superseded runs on the same branch/PR.
concurrency:
group: ci-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

jobs:
Expand All @@ -24,16 +29,23 @@ jobs:
bun-version: latest

- name: Install dependencies
run: bun install --frozen-lockfile
shell: bash
run: |-
bun install --frozen-lockfile

- name: Lint
run: bun run lint
run: |-
bun run lint

- name: Typecheck
run: bun run typecheck
shell: bash
run: |-
bun run typecheck

- name: Test (coverage + junit)
run: bun run test:coverage
shell: bash
run: |-
bun run test:coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
Expand All @@ -53,7 +65,9 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}

- name: Build
run: bun run build
shell: bash
run: |-
bun run build

web:
name: web
Expand All @@ -77,19 +91,25 @@ jobs:
# build:web).
- name: Install workspace dependencies
working-directory: .
run: bun install --frozen-lockfile
run: |-
bun install --frozen-lockfile

- name: Install dependencies
run: bun install --frozen-lockfile
run: |-
bun install --frozen-lockfile

- name: Lint
run: bun run lint
run: |-
bun run lint

- name: Typecheck
run: bun run typecheck
run: |-
bun run typecheck

- name: Test
run: bun run test
run: |-
bun run test

- name: Build
run: bun run build
run: |-
bun run build
59 changes: 44 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,35 @@
name: Release

on:
push:
tags: ["v*"]
release:
types:
- published

permissions:
contents: write # create the GitHub Release
id-token: write # npm provenance (public repo)
env:
REGEX_PATTERN: "^v[0-9]+\\.[0-9]+\\.[0-9]+$"
RELEASE_TAG: ${{ github.event.release.tag_name }}

jobs:
npm:
name: Publish to npm
name: Publish to npm
permissions:
contents: write # create the GitHub Release
id-token: write # npm provenance (public repo)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v6

- name: Validate Release Tag
id: validate_tag
shell: bash
run: |-
if [[ "${{ env.RELEASE_TAG }}" =~ ${{ env.REGEX_PATTERN }} ]] ; then
echo "Valid version format: ${{ env.RELEASE_TAG }}"
else
echo "Invalid version format: ${{ env.RELEASE_TAG }}"
exit 1
fi

- name: Setup Bun
uses: oven-sh/setup-bun@v2
Expand All @@ -29,19 +45,28 @@ jobs:
# OIDC Trusted Publishing requires the npm CLI >= 11.5.1; node 22 ships
# an older 10.x. No token after this — auth is the GitHub OIDC id-token.
- name: Upgrade npm for Trusted Publishing
run: npm install -g npm@latest
shell: bash
run: |-
npm install -g npm@latest

- name: Install dependencies
run: bun install --frozen-lockfile
shell: bash
run: |-
bun install --frozen-lockfile

- name: Build web UI
run: cd web && bun install --frozen-lockfile && bun run build
shell: bash
run: |-
cd web && bun install --frozen-lockfile && bun run build

- name: Test
run: bun run test
shell: bash
run: |-
bun run test

- name: Verify package version matches the tag
run: |
shell: bash
run: |-
PKG="$(node -p "require('./package.json').version")"
TAG="${GITHUB_REF_NAME#v}"
if [ "$PKG" != "$TAG" ]; then
Expand All @@ -55,7 +80,8 @@ jobs:
# @codeoid/protocol at npmjs.com (same OIDC setup as codeoid) before the
# first release that introduces a new protocol version.
- name: Publish @codeoid/protocol (OIDC) — only if version is new
run: |
shell: bash
run: |-
cd packages/protocol
VER="$(node -p "require('./package.json').version")"
if npm view "@codeoid/protocol@$VER" version >/dev/null 2>&1; then
Expand All @@ -69,7 +95,8 @@ jobs:
# after protocol (its peer dep) and needs its own Trusted Publisher +
# one-time manual bootstrap publish, same as protocol.
- name: Publish @codeoid/core (OIDC) — only if version is new
run: |
shell: bash
run: |-
cd packages/core
VER="$(node -p "require('./package.json').version")"
if npm view "@codeoid/core@$VER" version >/dev/null 2>&1; then
Expand All @@ -82,7 +109,9 @@ jobs:
# Trusted Publisher (configured on the package at npmjs.com). Provenance
# is generated automatically from the same OIDC identity.
- name: Publish codeoid to npm (OIDC Trusted Publishing)
run: npm publish --provenance --access public
shell: bash
run: |-
npm publish --provenance --access public

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
Expand Down
Loading