-
-
Notifications
You must be signed in to change notification settings - Fork 0
206 lines (183 loc) · 8.56 KB
/
Copy pathpipeline-parity-develop.yml
File metadata and controls
206 lines (183 loc) · 8.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
name: Pipeline Parity (Develop)
on:
push:
branches: [develop]
paths:
- 'src/**'
- 'packages/**'
- 'scripts/**'
- '.github/workflows/**'
workflow_dispatch:
inputs:
packages:
description: 'Packages to test (comma-separated or "all")'
required: false
default: 'all'
validator_version:
description: 'HL7 Validator version'
required: false
default: 'latest'
concurrency:
group: parity-develop-${{ github.ref }}
cancel-in-progress: false
# @max-health-inc/config is installed from GitHub Packages (see .npmrc), which needs a token
# even though the package is public. Set at workflow level so every `npm ci` below is covered.
# An unset secret expands to an EMPTY string and fails with a 401 identical to a bad token.
# Nothing in this workflow publishes, so a workflow-wide NODE_AUTH_TOKEN is safe here.
env:
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }}
jobs:
# ── Run both validators in parallel (reusable workflow) ────────────────────
parity-tests:
uses: ./.github/workflows/_parity-tests.yml
# Required: the reusable workflow's `npm ci` needs GH_PACKAGES_TOKEN to fetch
# @max-health-inc/config, and a called workflow sees NO secrets without this.
secrets: inherit
with:
packages: ${{ github.event.inputs.packages || 'all' }}
validator_version: ${{ github.event.inputs.validator_version || 'latest' }}
# ── Deploy pre-release results to GitHub Pages (develop/) ────────────────────
deploy:
needs: parity-tests
if: always() && needs.parity-tests.result != 'skipped'
runs-on: ubuntu-latest
concurrency:
group: gh-pages-deploy
cancel-in-progress: false
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
ref: develop
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Download Firely reports
uses: actions/download-artifact@v8
with:
name: firely-reports
path: develop-reports/firely
continue-on-error: true
- name: Download HL7 reports
uses: actions/download-artifact@v8
with:
name: hl7-reports
path: develop-reports/hl7
continue-on-error: true
- name: Download internal reports
uses: actions/download-artifact@v8
with:
name: internal-reports
path: develop-reports/internal
continue-on-error: true
- name: Prepare deploy directory
run: |
DEPLOY_DIR=$(mktemp -d)
echo "DEPLOY_DIR=$DEPLOY_DIR" >> $GITHUB_ENV
# Checkout existing gh-pages content
git fetch origin gh-pages:gh-pages 2>/dev/null || true
if git show-ref --verify --quiet refs/heads/gh-pages; then
git worktree add "$DEPLOY_DIR" gh-pages
else
git worktree add --orphan "$DEPLOY_DIR" gh-pages 2>/dev/null || {
git worktree add "$DEPLOY_DIR" --detach
git -C "$DEPLOY_DIR" checkout --orphan gh-pages
git -C "$DEPLOY_DIR" rm -rf . 2>/dev/null || true
}
fi
# Create develop subdirectory (preserve main results at root)
mkdir -p "$DEPLOY_DIR/develop/badges"
- name: Clear stale pre-release data
run: |
# Remove old prerelease data so failed runs don't show stale results
rm -f "$DEPLOY_DIR"/parity-data-prerelease.json
rm -f "$DEPLOY_DIR"/parity-data-hl7-prerelease.json
rm -f "$DEPLOY_DIR"/parity-data-internal-prerelease.json
rm -f "$DEPLOY_DIR"/develop/parity-data.json
rm -f "$DEPLOY_DIR"/develop/parity-data-hl7.json
rm -f "$DEPLOY_DIR"/develop/parity-data-internal.json
rm -f "$DEPLOY_DIR"/develop/SUMMARY-*.md
rm -f "$DEPLOY_DIR"/develop/*-DETAIL*.md
- name: Copy pre-release data to gh-pages root and develop/
run: |
# Copy Firely pre-release data
if [ -d "develop-reports/firely" ]; then
# Root-level pre-release data (for unified index.html)
cp develop-reports/firely/parity-data.json "$DEPLOY_DIR/parity-data-prerelease.json" 2>/dev/null || true
# develop/ subdirectory copies
cp develop-reports/firely/parity-data.json "$DEPLOY_DIR/develop/" 2>/dev/null || true
cp develop-reports/firely/badge-*.json "$DEPLOY_DIR/develop/badges/" 2>/dev/null || true
cp develop-reports/firely/*-DETAIL-firely.md "$DEPLOY_DIR/develop/" 2>/dev/null || true
cp develop-reports/firely/SUMMARY.md "$DEPLOY_DIR/develop/SUMMARY-firely.md" 2>/dev/null || true
fi
# Copy HL7 pre-release data
if [ -d "develop-reports/hl7" ]; then
# Root-level pre-release data (for unified index.html)
cp develop-reports/hl7/parity-data-hl7.json "$DEPLOY_DIR/parity-data-hl7-prerelease.json" 2>/dev/null || true
# develop/ subdirectory copies
cp develop-reports/hl7/parity-data-hl7.json "$DEPLOY_DIR/develop/" 2>/dev/null || true
cp develop-reports/hl7/badge-hl7-*.json "$DEPLOY_DIR/develop/badges/" 2>/dev/null || true
cp develop-reports/hl7/*-DETAIL-hl7.md "$DEPLOY_DIR/develop/" 2>/dev/null || true
cp develop-reports/hl7/SUMMARY.md "$DEPLOY_DIR/develop/SUMMARY-hl7.md" 2>/dev/null || true
fi
# Copy internal pre-release data
if [ -d "develop-reports/internal" ]; then
# Root-level pre-release data (for unified index.html)
cp develop-reports/internal/parity-data-internal.json "$DEPLOY_DIR/parity-data-internal-prerelease.json" 2>/dev/null || true
# develop/ subdirectory copies
cp develop-reports/internal/parity-data-internal.json "$DEPLOY_DIR/develop/" 2>/dev/null || true
cp develop-reports/internal/badge-internal-*.json "$DEPLOY_DIR/develop/badges/" 2>/dev/null || true
cp develop-reports/internal/*-DETAIL-internal.md "$DEPLOY_DIR/develop/" 2>/dev/null || true
cp develop-reports/internal/SUMMARY.md "$DEPLOY_DIR/develop/SUMMARY-internal.md" 2>/dev/null || true
fi
- name: Patch pre-release version from latest dev tag
run: |
git fetch --tags origin
# Find latest dev pre-release tag (e.g., v1.1.5-dev.20260327194307.5d601fd)
LATEST_DEV_TAG=$(git tag --sort=-v:refname --list 'v*-dev.*' | head -1)
if [ -n "$LATEST_DEV_TAG" ]; then
VERSION="${LATEST_DEV_TAG#v}"
for f in "$DEPLOY_DIR"/parity-data-prerelease.json "$DEPLOY_DIR"/develop/parity-data.json "$DEPLOY_DIR"/parity-data-hl7-prerelease.json "$DEPLOY_DIR"/develop/parity-data-hl7.json "$DEPLOY_DIR"/parity-data-internal-prerelease.json "$DEPLOY_DIR"/develop/parity-data-internal.json; do
if [ -f "$f" ]; then
jq --arg v "$VERSION" '.babelfhirVersion = $v' "$f" > "${f}.tmp" && mv "${f}.tmp" "$f"
fi
done
echo "Patched pre-release version to $LATEST_DEV_TAG"
else
echo "No dev tag found — using version from parity data"
fi
- name: Regenerate unified report page
run: |
# Append current pre-release results to trend history
node scripts/update-history.js "$DEPLOY_DIR"
# Regenerate root index.html with both stable + pre-release data
node scripts/generate-report-page.js "$DEPLOY_DIR" "$DEPLOY_DIR"
node scripts/generate-report-downloads.js "$DEPLOY_DIR"
- name: Ensure .nojekyll exists
run: touch "$DEPLOY_DIR/.nojekyll"
- name: Commit and push to gh-pages
run: |
cd "$DEPLOY_DIR"
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git add -A
if git diff --cached --quiet; then
echo "No changes to deploy"
else
git commit -m "Update pre-release parity report (develop) [skip ci]"
git push origin gh-pages
echo "Deployed pre-release results to GitHub Pages /develop/"
fi
- name: Cleanup worktree
if: always()
run: |
cd "${{ github.workspace }}"
git worktree remove "$DEPLOY_DIR" --force 2>/dev/null || true