Skip to content

perf: sequential publish in single job with OIDC token caching - #88

Merged
Farenheith merged 5 commits into
masterfrom
feat/sequential-publish-pipeline
Aug 21, 2026
Merged

perf: sequential publish in single job with OIDC token caching#88
Farenheith merged 5 commits into
masterfrom
feat/sequential-publish-pipeline

Conversation

@Farenheith

@Farenheith Farenheith commented Aug 21, 2026

Copy link
Copy Markdown
Member

Summary

Replace the matrix-strategy publish pipeline (one runner per library) with a single job that publishes packages sequentially. This eliminates per-runner overhead (~30s × N) and caches the OIDC JWT for reuse across libraries.

Changes

  • Single job instead of matrix — one GitHub Actions runner, no parallel setup cost
  • Dynamic package discovery — scans libs/*/ for non-private packages at runtime
  • OIDC token caching — obtains the JWT once and reuses it within a 4-minute window (GitHub's OIDC tokens are valid ~5 min), avoiding repeated curl calls
  • Sequential publish loop — each library runs release-it in order, tags/pushes before moving to the next

Key details

Token refresh logic:

NOW=$(date +%s)
# Token TTL is ~5 min; refresh if older than 4 min
if [ $((NOW - TOKEN_OBTAINED_AT)) -gt 240 ] || [ -z "$OIDC_TOKEN" ]; then
    OIDC_TOKEN=$(curl ... | jq -r '.value')
    TOKEN_OBTAINED_AT=$(date +%s)
fi
  • Token TTL refresh threshold: 240s (4 min) — leaves 1 min buffer before GitHub's ~5 min expiry
  • Packages discovered via: for lib in libs/*/; do node -p "require('./${lib}package.json').name" filtered by private != true

Publish summary

Accurate reporting of published vs skipped libraries:

=== Summary ===
Published:
  ✓ @codibre/fluent-iterable
Skipped (no new commits):
  ⏭️  augmentative-iterable
  ⏭️  @fluent-iterable/js-sdsl
  ⏭️  @fluent-iterable/rxjs
Successfully published 1 library(ies).

Build & lint

All passing on the branch.

Port @fluent-iterable/async-sema into the monorepo workspace.
Includes source, tests, and config files adapted to the codibre pattern.
Added to publish matrix in .github/workflows/publish.yaml.
- Replace matrix strategy with a single job running packages sequentially
- Discover non-private packages dynamically via pnpm workspace scan
- Obtain OIDC token once and reuse within 4-minute window (token TTL ~5 min)
- Eliminates per-job runner overhead (~30s × N jobs → one setup)
Track published vs skipped libs separately and report correctly.
@Farenheith
Farenheith force-pushed the feat/sequential-publish-pipeline branch from 209194f to b605852 Compare August 21, 2026 10:50
Resolved merge conflicts:
- Kept sequential publish job (no matrix strategy) from feature branch
- Updated async-sema version to 0.2.0 per master
@Farenheith Farenheith closed this Aug 21, 2026
@Farenheith Farenheith reopened this Aug 21, 2026
@Farenheith
Farenheith merged commit 3b4c0f1 into master Aug 21, 2026
4 checks passed
@Farenheith
Farenheith deleted the feat/sequential-publish-pipeline branch August 21, 2026 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant