Release v1.7.7 #9
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish JSR | |
| on: | |
| push: | |
| tags: | |
| - "*" | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Checkout spry repo | |
| uses: actions/checkout@v5 | |
| with: | |
| repository: programmablemd/spry | |
| token: ${{ secrets.GH_PAT }} | |
| path: spry | |
| - name: Copy source files from spry repo | |
| run: | | |
| # Exclude list: README.md, mod.ts, jsr.json, LICENSE (keep our local versions) | |
| EXCLUDE="--exclude=README.md --exclude=mod.ts --exclude=jsr.json --exclude=LICENSE" | |
| EXCLUDE2="--exclude=README.md --exclude=jsr.json --exclude=LICENSE" | |
| # Copy to jsr_package/universal (both as subfolders to preserve import paths) | |
| rsync -a $EXCLUDE spry/lib/universal/ jsr_package/universal/ | |
| rsync -a $EXCLUDE spry/lib/spawn/ jsr_package/universal/spawn/ | |
| # Copy to jsr_package/extend (from lib/extend) | |
| rsync -a $EXCLUDE spry/lib/extend/ jsr_package/extend/ | |
| # Copy to jsr_package/reflect (from lib/reflect) | |
| rsync -a $EXCLUDE spry/lib/reflect/ jsr_package/reflect/ | |
| # Copy to jsr_package/spawn (from lib/spawn, includes sql-shell subfolder, and universal as subfolder) | |
| rsync -a $EXCLUDE2 spry/lib/spawn/ jsr_package/spawn/ | |
| rsync -a $EXCLUDE spry/lib/universal/ jsr_package/spawn/universal/ | |
| # Copy to jsr_package/tap (from lib/tap) | |
| rsync -a $EXCLUDE spry/lib/tap/ jsr_package/tap/ | |
| # Copy to jsr_package/courier (from lib/courier) | |
| rsync -a $EXCLUDE spry/lib/courier/ jsr_package/courier/ | |
| - name: Fix imports for JSR structure | |
| run: | | |
| # Fix universal package: files in root (doctor.ts etc) need to find bundled spawn and same-dir universal | |
| # ../spawn/ -> ./spawn/ | |
| # ../universal/ -> ./ | |
| find jsr_package/universal -maxdepth 1 -name "*.ts" -exec sed -i 's|import { shell as makeShell } from "../spawn/shell.ts";|import { shell as makeShell } from "./spawn/shell.ts";|g' {} + | |
| find jsr_package/universal -maxdepth 1 -name "*.ts" -exec sed -i 's|\.\./universal/|\./|g' {} + | |
| # Fix universal package subfolder (spawn): needs to refer to parent for universal files | |
| # ../universal/event-bus.ts -> ../event-bus.ts | |
| find jsr_package/universal/spawn -name "*.ts" -exec sed -i 's|\.\./universal/|\.\./|g' {} + | |
| # Fix spawn package: files in root need to find bundled universal | |
| # ../universal/ -> ./universal/ | |
| find jsr_package/spawn -maxdepth 1 -name "*.ts" -exec sed -i 's|\.\./universal/|\./universal/|g' {} + | |
| # Fix spawn package subfolder (sql-shell): | |
| # ../../universal/ -> ../universal/ | |
| find jsr_package/spawn/sql-shell -name "*.ts" -exec sed -i 's|\.\./\.\./universal/|\.\./universal/|g' {} + | |
| # Fix spawn package subfolder (universal): | |
| # ../universal/ -> ./ | |
| # ../spawn/ -> ../ | |
| find jsr_package/spawn/universal -name "*.ts" -exec sed -i 's|\.\./universal/|\./|g' {} + | |
| find jsr_package/spawn/universal -name "*.ts" -exec sed -i 's|\.\./spawn/|\.\./|g' {} + | |
| - name: Update jsr.json version from git tag | |
| run: | | |
| VERSION=${GITHUB_REF#refs/tags/} | |
| VERSION=${VERSION#v} | |
| for pkg in universal extend reflect spawn tap courier; do | |
| echo "Updating version for $pkg to $VERSION" | |
| cd jsr_package/$pkg | |
| jq --arg version "$VERSION" '.version = $version' jsr.json > jsr.json.tmp && mv jsr.json.tmp jsr.json | |
| cd ../.. | |
| done | |
| - name: Publish JSR packages | |
| run: | | |
| for pkg in universal extend reflect spawn tap courier; do | |
| echo "Publishing $pkg" | |
| cd jsr_package/$pkg | |
| npx jsr publish --allow-dirty --allow-slow-types | |
| cd ../.. | |
| done |