Skip to content
Merged
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
52 changes: 13 additions & 39 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ on:
description: Canonical release tag to publish
required: true
type: string
release_mode:
description: Select changed packages or every package
default: changed
required: true
type: choice
options:
- changed
- all

jobs:
cd:
Expand All @@ -39,44 +31,19 @@ jobs:
cache: 'npm'
registry-url: 'https://registry.npmjs.org'

- name: Configure release
- name: Select release tag
id: release
env:
EVENT_NAME: ${{ github.event_name }}
RELEASE_BODY: ${{ github.event.release.body }}
RELEASE_TAG: ${{ github.event.release.tag_name }}
INPUT_RELEASE_MODE: ${{ inputs.release_mode }}
INPUT_RELEASE_TAG: ${{ inputs.release_tag }}
run: |
if [ "$EVENT_NAME" = 'release' ]; then
echo "tag=$RELEASE_TAG" >> "$GITHUB_OUTPUT"
if printf '%s\n' "$RELEASE_BODY" | grep -Eq '(^|[[:space:]])release-mode:[[:space:]]*all([[:space:]]|$)'; then
echo 'mode=all' >> "$GITHUB_OUTPUT"
else
echo 'mode=changed' >> "$GITHUB_OUTPUT"
fi
else
echo "tag=$INPUT_RELEASE_TAG" >> "$GITHUB_OUTPUT"
echo "mode=$INPUT_RELEASE_MODE" >> "$GITHUB_OUTPUT"
fi

- name: Generate release plan
id: release_plan
env:
RELEASE_MODE: ${{ steps.release.outputs.mode }}
RELEASE_PLAN_PATH: ${{ runner.temp }}/release-plan.json
run: |
node scripts/release/generate-release-plan.ts "${{ steps.release.outputs.tag }}" > "$RELEASE_PLAN_PATH"
package_count=$(node -e 'const { packageNames } = JSON.parse(require("node:fs").readFileSync(process.env.RELEASE_PLAN_PATH)); process.stdout.write(String(packageNames.length));')
echo "package_count=$package_count" >> "$GITHUB_OUTPUT"

- name: Stage release manifests
env:
RELEASE_PLAN_PATH: ${{ runner.temp }}/release-plan.json
run: |
node scripts/release/stage-release.ts "${{ steps.release.outputs.tag }}" "$RELEASE_PLAN_PATH"
npm install

- name: Check code
run: npm run lint

Expand All @@ -95,10 +62,17 @@ jobs:
- name: Check packages
run: npm run publint

- name: Publish packages
if: steps.release_plan.outputs.package_count != '0'
- name: Publish framework
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
RELEASE_PLAN_PATH: ${{ runner.temp }}/release-plan.json
run: |
node scripts/release/publish-release.ts "${{ steps.release.outputs.tag }}" "$RELEASE_PLAN_PATH"
run: npm publish

split_components:
needs: cd
uses: ./.github/workflows/split-components.yml
with:
source_ref: ${{ github.event_name == 'release' && github.event.release.tag_name || inputs.release_tag }}
source_branch: ${{ github.event_name == 'release' && github.event.release.tag_name || inputs.release_tag }}
source_type: tag
sync: true
secrets: inherit
58 changes: 58 additions & 0 deletions .github/workflows/publish-component.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Publish component

on:
workflow_call:
inputs:
framework_ref:
description: Framework branch containing the release templates
required: true
type: string
dry_run:
description: Validate the package without publishing it
required: false
default: false
type: boolean

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write

steps:
- name: Checkout component
uses: actions/checkout@v4

- name: Checkout release templates
uses: actions/checkout@v4
with:
repository: koala-ts/framework
ref: ${{ inputs.framework_ref }}
path: framework
persist-credentials: false

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: npm install --package-lock=false

- name: Apply release TypeScript configuration
run: cp framework/templates/component-release/tsconfig.json tsconfig.json

- name: Check types
run: npm run typecheck

- name: Build
run: npm run build

- name: Check package
run: npm run publint

- name: Publish package
if: ${{ !inputs.dry_run }}
run: npm publish
28 changes: 22 additions & 6 deletions .github/workflows/split-components.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on:
push:
branches:
- 2.x
tags:
- '*'
workflow_dispatch:
inputs:
source_branch:
Expand All @@ -18,6 +16,24 @@ on:
required: true
default: false
type: boolean
workflow_call:
inputs:
source_ref:
description: Source Git reference to split
required: true
type: string
source_branch:
description: Destination branch or tag name
required: true
type: string
source_type:
description: Type of destination Git reference
required: true
type: string
sync:
description: Push the split reference to component repositories
required: true
type: boolean

jobs:
split:
Expand All @@ -31,7 +47,7 @@ jobs:
with:
fetch-depth: 0
persist-credentials: false
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.source_branch || github.ref }}
ref: ${{ github.event_name == 'workflow_call' && inputs.source_ref || github.event_name == 'workflow_dispatch' && inputs.source_branch || github.ref }}

- name: Install splitsh-lite
run: |
Expand All @@ -49,7 +65,7 @@ jobs:
- name: Split components
env:
SPLITTER_TOKEN: ${{ steps.app-token.outputs.token }}
SOURCE_BRANCH: ${{ github.event_name == 'workflow_dispatch' && inputs.source_branch || github.ref_name }}
SOURCE_TYPE: ${{ github.event_name == 'workflow_dispatch' && 'branch' || github.ref_type }}
SYNC: ${{ github.event_name != 'workflow_dispatch' || inputs.sync }}
SOURCE_BRANCH: ${{ github.event_name == 'workflow_call' && inputs.source_branch || github.event_name == 'workflow_dispatch' && inputs.source_branch || github.ref_name }}
SOURCE_TYPE: ${{ github.event_name == 'workflow_call' && inputs.source_type || github.event_name == 'workflow_dispatch' && 'branch' || github.ref_type }}
SYNC: ${{ github.event_name == 'workflow_call' && inputs.sync || github.event_name != 'workflow_dispatch' || inputs.sync }}
run: bash scripts/split/split-components.sh
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 0 additions & 54 deletions scripts/release/generate-release-plan.ts

This file was deleted.

67 changes: 0 additions & 67 deletions scripts/release/package-selection.test.ts

This file was deleted.

59 changes: 0 additions & 59 deletions scripts/release/package-selection.ts

This file was deleted.

Loading
Loading