Skip to content

Commit f62d374

Browse files
committed
fix: report page version not updating after releases
Release workflow now patches babelfhirVersion in parity-data JSON on gh-pages and regenerates the report page. Also fixed getVersion() to fall back to internal data when firely/hl7 data is absent.
1 parent 89283dd commit f62d374

2 files changed

Lines changed: 39 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,43 @@ jobs:
215215
body: message
216216
});
217217
218+
- name: Patch version on gh-pages report
219+
run: |
220+
VERSION="${{ steps.final_version.outputs.version }}"
221+
git fetch origin gh-pages:gh-pages 2>/dev/null || { echo "No gh-pages branch"; exit 0; }
222+
223+
DEPLOY_DIR=$(mktemp -d)
224+
git worktree add "$DEPLOY_DIR" gh-pages
225+
226+
PATCHED=false
227+
for f in "$DEPLOY_DIR"/parity-data.json "$DEPLOY_DIR"/parity-data-hl7.json "$DEPLOY_DIR"/parity-data-internal.json; do
228+
if [ -f "$f" ]; then
229+
jq --arg v "$VERSION" '.babelfhirVersion = $v' "$f" > "${f}.tmp" && mv "${f}.tmp" "$f"
230+
PATCHED=true
231+
fi
232+
done
233+
234+
if [ "$PATCHED" = "true" ]; then
235+
# Regenerate report page with updated version
236+
if [ -f "scripts/generate-report-page.js" ]; then
237+
node scripts/generate-report-page.js "$DEPLOY_DIR" "$DEPLOY_DIR"
238+
fi
239+
cd "$DEPLOY_DIR"
240+
git config user.email "github-actions[bot]@users.noreply.github.com"
241+
git config user.name "github-actions[bot]"
242+
git add -A
243+
if git diff --cached --quiet; then
244+
echo "Report already at v$VERSION"
245+
else
246+
git commit -m "chore: update report version to v$VERSION [skip ci]"
247+
git push origin gh-pages
248+
echo "Patched report version to v$VERSION"
249+
fi
250+
else
251+
echo "No parity data files found on gh-pages — skipping"
252+
fi
253+
git worktree remove "$DEPLOY_DIR" 2>/dev/null || true
254+
218255
- name: Notify on failure
219256
if: failure() && github.event_name == 'pull_request'
220257
uses: actions/github-script@v7

scripts/generate-report-page.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,8 @@ function getVersion(data) {
431431
return `v${JSON.parse(fs.readFileSync(pkgPath, 'utf8')).version}`;
432432
} catch { return ''; }
433433
}
434-
const stableVersion = getVersion(firely || hl7);
435-
const prereleaseVersion = getVersion(firelyPre || hl7Pre);
434+
const stableVersion = getVersion(firely || hl7 || internal);
435+
const prereleaseVersion = getVersion(firelyPre || hl7Pre || internalPre);
436436

437437
// Load trend history for charts (pre-release only; release chart removed)
438438
const prereleaseHistory = loadJSON('history.json');

0 commit comments

Comments
 (0)