Add debugging to workflow and bump to 0.2.5
Some checks failed
FHIR IG CI/CD Pipeline with Version Persistence / build-ig (push) Failing after 29s
FHIR IG CI/CD Pipeline with Version Persistence / deploy (push) Has been skipped

This commit is contained in:
2026-03-07 01:06:10 +06:00
parent 2b2ec21c24
commit 68c748b06e
5 changed files with 134 additions and 76 deletions

View File

@@ -53,6 +53,81 @@ jobs:
echo "build_type=$BUILD_TYPE" >> $GITHUB_OUTPUT echo "build_type=$BUILD_TYPE" >> $GITHUB_OUTPUT
echo "Build type: $BUILD_TYPE" echo "Build type: $BUILD_TYPE"
# NEW STEP: Update package-list.json BEFORE build so IG Publisher can use it
- name: Pre-build package-list.json update
run: |
VERSION="${{ steps.version.outputs.version }}"
BUILD_TYPE="${{ steps.version.outputs.build_type }}"
DATE=$(date +%Y-%m-%d)
# Only update for release builds
if [ "$BUILD_TYPE" != "release" ]; then
echo " Dev build - skipping package-list.json pre-build update"
exit 0
fi
echo "📋 Updating package-list.json before build..."
# Check if package-list.json exists
if [ ! -f "package-list.json" ]; then
echo "⚠️ package-list.json not found in repo - history.html won't be generated"
echo "Creating minimal package-list.json for this build..."
cat > package-list.json << EOF
{
"package-id": "bd.fhir.core",
"title": "Bangladesh Core FHIR Implementation Guide",
"canonical": "https://fhir.dghs.gov.bd/core",
"introduction": "Core FHIR profiles and extensions for Bangladesh healthcare",
"list": [
{
"version": "current",
"desc": "Continuous Integration Build (latest in version control)",
"path": "https://fhir.dghs.gov.bd/core/",
"status": "ci-build",
"current": true
}
]
}
EOF
fi
# Update package-list.json with new version
python3 << 'PYEOF'
import json
import sys
version = "$VERSION"
date = "$DATE"
with open('package-list.json', 'r') as f:
pkg_list = json.load(f)
# Check if this version already exists
version_exists = any(e['version'] == version for e in pkg_list['list'])
if not version_exists:
new_entry = {
"version": version,
"date": date,
"desc": f"Release {version}",
"path": f"https://fhir.dghs.gov.bd/core/{version}/",
"status": "trial-use",
"sequence": "STU 1"
}
# Insert after 'current' entry
pkg_list['list'].insert(1, new_entry)
with open('package-list.json', 'w') as f:
json.dump(pkg_list, f, indent=2)
print(f"✅ Added version {version} to package-list.json")
else:
print(f" Version {version} already exists in package-list.json")
PYEOF
echo "📋 package-list.json is ready for IG Publisher"
cat package-list.json
- name: Install Docker CLI - name: Install Docker CLI
run: | run: |
apt-get update apt-get update
@@ -94,91 +169,49 @@ jobs:
exit 1 exit 1
fi fi
# Check if history.html was generated
if [ -f "output/history.html" ]; then
echo "✅ history.html generated successfully"
else
echo "⚠️ WARNING: history.html was not generated"
echo "This usually means package-list.json was missing or invalid"
fi
echo "✅ Build successful!" echo "✅ Build successful!"
- name: Update package-list.json and package-feed.xml for releases - name: Update package-feed.xml for releases
if: steps.version.outputs.build_type == 'release' if: steps.version.outputs.build_type == 'release'
run: | run: |
VERSION="${{ steps.version.outputs.version }}" VERSION="${{ steps.version.outputs.version }}"
DATE=$(date +%Y-%m-%d)
DATETIME=$(date -u +%Y-%m-%dT%H:%M:%SZ) DATETIME=$(date -u +%Y-%m-%dT%H:%M:%SZ)
# Update package-list.json and package-feed.xml cat > update-feed.py << 'EOF'
cat > update-registry-files.py << 'EOF'
import json
import sys import sys
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
from datetime import datetime
version = sys.argv[1] version = sys.argv[1]
date = sys.argv[2] datetime_iso = sys.argv[2]
datetime_iso = sys.argv[3]
# ========== Update package-list.json ==========
with open('package-list.json', 'r') as f:
pkg_list = json.load(f)
# Update current build path
for entry in pkg_list['list']:
if entry['version'] == 'current':
entry['path'] = 'https://fhir.dghs.gov.bd/core/'
break
# Check if this version already exists
version_exists = any(e['version'] == version for e in pkg_list['list'])
if not version_exists:
# Add new version entry
new_entry = {
"version": version,
"date": date,
"desc": f"Release {version}",
"path": f"https://fhir.dghs.gov.bd/core/{version}/",
"status": "trial-use",
"sequence": "STU 1"
}
# Insert after 'current' entry
pkg_list['list'].insert(1, new_entry)
else:
# Update existing entry
for entry in pkg_list['list']:
if entry['version'] == version:
entry['date'] = date
entry['path'] = f"https://fhir.dghs.gov.bd/core/{version}/"
break
with open('output/package-list.json', 'w') as f:
json.dump(pkg_list, f, indent=2)
print(f"✅ Updated package-list.json with version {version}")
# ========== Update package-feed.xml ==========
# Register namespaces
ET.register_namespace('', 'http://www.w3.org/2005/Atom') ET.register_namespace('', 'http://www.w3.org/2005/Atom')
# Parse existing feed
tree = ET.parse('package-feed.xml') tree = ET.parse('package-feed.xml')
root = tree.getroot() root = tree.getroot()
ns = {'atom': 'http://www.w3.org/2005/Atom'} ns = {'atom': 'http://www.w3.org/2005/Atom'}
# Update feed updated timestamp
updated_elem = root.find('atom:updated', ns) updated_elem = root.find('atom:updated', ns)
if updated_elem is not None: if updated_elem is not None:
updated_elem.text = datetime_iso updated_elem.text = datetime_iso
# Check if entry for this version already exists
entry_exists = False entry_exists = False
for entry in root.findall('atom:entry', ns): for entry in root.findall('atom:entry', ns):
title = entry.find('atom:title', ns) title = entry.find('atom:title', ns)
if title is not None and version in title.text: if title is not None and version in title.text:
entry_exists = True entry_exists = True
# Update existing entry timestamp
entry_updated = entry.find('atom:updated', ns) entry_updated = entry.find('atom:updated', ns)
if entry_updated is not None: if entry_updated is not None:
entry_updated.text = datetime_iso entry_updated.text = datetime_iso
break break
# If entry doesn't exist, create new one
if not entry_exists: if not entry_exists:
new_entry = ET.Element('{http://www.w3.org/2005/Atom}entry') new_entry = ET.Element('{http://www.w3.org/2005/Atom}entry')
@@ -198,8 +231,6 @@ jobs:
summary = ET.SubElement(new_entry, '{http://www.w3.org/2005/Atom}summary') summary = ET.SubElement(new_entry, '{http://www.w3.org/2005/Atom}summary')
summary.text = f"Release {version} of Bangladesh Core FHIR Implementation Guide" summary.text = f"Release {version} of Bangladesh Core FHIR Implementation Guide"
# Insert new entry at the beginning (after feed metadata)
# Find the position after the last feed-level element
insert_pos = 0 insert_pos = 0
for i, child in enumerate(root): for i, child in enumerate(root):
if child.tag.endswith('entry'): if child.tag.endswith('entry'):
@@ -209,36 +240,32 @@ jobs:
root.insert(insert_pos, new_entry) root.insert(insert_pos, new_entry)
# Write updated feed
tree.write('output/package-feed.xml', encoding='utf-8', xml_declaration=True) tree.write('output/package-feed.xml', encoding='utf-8', xml_declaration=True)
print(f"✅ Updated package-feed.xml with version {version}") print(f"✅ Updated package-feed.xml")
EOF EOF
python3 update-registry-files.py "$VERSION" "$DATE" "$DATETIME" python3 update-feed.py "$VERSION" "$DATETIME"
# Copy updated files # Also copy the updated package-list.json to output
cp output/package-list.json package-list.json cp package-list.json output/package-list.json
cp output/package-feed.xml package-feed.xml
echo "📋 Updated registry files (package-list.json and package-feed.xml)" echo "📋 Updated registry files"
- name: Prepare deployment artifact - name: Prepare deployment artifact
run: | run: |
VERSION="${{ steps.version.outputs.version }}" VERSION="${{ steps.version.outputs.version }}"
BUILD_TYPE="${{ steps.version.outputs.build_type }}" BUILD_TYPE="${{ steps.version.outputs.build_type }}"
# Create a tarball of the output tar -czf ig-output.tar.gz -C output .
if [ "$BUILD_TYPE" == "release" ]; then
tar -czf ig-output.tar.gz -C output .
else
tar -czf ig-output.tar.gz -C output .
fi
echo "version=$VERSION" > deployment.env echo "version=$VERSION" > deployment.env
echo "build_type=$BUILD_TYPE" >> deployment.env echo "build_type=$BUILD_TYPE" >> deployment.env
echo "build_date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> deployment.env echo "build_date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> deployment.env
# List what's in the output
echo "📦 Output contents:"
ls -lh output/ | grep -E "(history\.html|package-list\.json|package-feed\.xml|index\.html)"
ls -lh ig-output.tar.gz ls -lh ig-output.tar.gz
- name: Upload artifact - name: Upload artifact
@@ -315,6 +342,9 @@ jobs:
else else
TARGET_DIR="$VERSIONS_DIR/dev" TARGET_DIR="$VERSIONS_DIR/dev"
echo "🔧 Deploying dev build to: $TARGET_DIR" echo "🔧 Deploying dev build to: $TARGET_DIR"
echo "Cleaning old dev files..."
rm -rf "$TARGET_DIR"/*
fi fi
# Create target directory # Create target directory
@@ -324,7 +354,13 @@ jobs:
echo "Extracting IG output..." echo "Extracting IG output..."
tar -xzf /tmp/fhir-ig-deploy/ig-output.tar.gz -C "$TARGET_DIR" tar -xzf /tmp/fhir-ig-deploy/ig-output.tar.gz -C "$TARGET_DIR"
# Copy package-list.json to root # Verify history.html was deployed
if [ -f "$TARGET_DIR/history.html" ]; then
echo "✅ history.html deployed successfully"
else
echo "⚠️ WARNING: history.html not found in deployment"
fi
cp /tmp/fhir-ig-deploy/package-list.json "$VERSIONS_DIR/package-list.json" cp /tmp/fhir-ig-deploy/package-list.json "$VERSIONS_DIR/package-list.json"
# Copy package-feed.xml to root # Copy package-feed.xml to root
@@ -347,9 +383,9 @@ jobs:
exit 1 exit 1
fi fi
# Restart nginx to pick up new content # Force recreate container to ensure new config/mounts are applied
docker compose -f docker-compose.prod.yml restart fhir-ig || \ # This handles "stuck" states better than a simple restart
docker compose -f docker-compose.prod.yml up -d docker compose -f docker-compose.prod.yml up -d --force-recreate fhir-ig
# Cleanup # Cleanup
rm -rf /tmp/fhir-ig-deploy rm -rf /tmp/fhir-ig-deploy
@@ -359,6 +395,7 @@ jobs:
echo "Version $version is now available at:" echo "Version $version is now available at:"
if [ "$build_type" == "release" ]; then if [ "$build_type" == "release" ]; then
echo " - https://fhir.dghs.gov.bd/core/$version/" echo " - https://fhir.dghs.gov.bd/core/$version/"
echo " - https://fhir.dghs.gov.bd/core/$version/history.html"
echo " - https://fhir.dghs.gov.bd/core/ (current)" echo " - https://fhir.dghs.gov.bd/core/ (current)"
else else
echo " - https://fhir.dghs.gov.bd/core/dev/" echo " - https://fhir.dghs.gov.bd/core/dev/"
@@ -367,4 +404,4 @@ jobs:
# List all versions # List all versions
echo "Available versions:" echo "Available versions:"
ls -lh "$VERSIONS_DIR" | grep -v total ls -lh "$VERSIONS_DIR" | grep -v total

View File

@@ -13,7 +13,7 @@
</extension>--> </extension>-->
<url value="https://fhir.dghs.gov.bd/core/ImplementationGuide/bd.fhir.core"/> <url value="https://fhir.dghs.gov.bd/core/ImplementationGuide/bd.fhir.core"/>
<!-- This version will propagate to all artifacts unless the "propagate-version" extension is overridden --> <!-- This version will propagate to all artifacts unless the "propagate-version" extension is overridden -->
<version value="0.2.4"/> <version value="0.2.5"/>
<name value="BangladeshCoreFHIRIG"/> <name value="BangladeshCoreFHIRIG"/>
<title value="Bangladesh Core FHIR Implementation Guide"/> <title value="Bangladesh Core FHIR Implementation Guide"/>
<status value="active"/> <status value="active"/>
@@ -102,6 +102,11 @@
<title value="IG Change History"/> <title value="IG Change History"/>
<generation value="html"/> <generation value="html"/>
</page> </page>
<page>
<nameUrl value="history.html"/>
<title value="Version History"/>
<generation value="html"/>
</page>
</page> </page>
<!-- copyright year is a mandatory parameter --> <!-- copyright year is a mandatory parameter -->
<parameter> <parameter>

View File

@@ -11,6 +11,14 @@
"status": "ci-build", "status": "ci-build",
"current": true "current": true
}, },
{
"version": "0.2.4",
"date": "2025-10-06",
"desc": "Second draft release of the Bangladesh Core FHIR IG",
"path": "https://fhir.dghs.gov.bd/core/0.2.4/",
"status": "trial-use",
"sequence": "STU 1"
},
{ {
"version": "0.2.3", "version": "0.2.3",
"date": "2025-10-06", "date": "2025-10-06",

View File

@@ -11,6 +11,14 @@
"status": "ci-build", "status": "ci-build",
"current": true "current": true
}, },
{
"version": "0.2.4",
"date": "2025-10-06",
"desc": "Second draft release of the Bangladesh Core FHIR IG",
"path": "https://fhir.dghs.gov.bd/core/0.2.4/",
"status": "trial-use",
"sequence": "STU 1"
},
{ {
"version": "0.2.3", "version": "0.2.3",
"date": "2025-10-06", "date": "2025-10-06",

View File

@@ -6,7 +6,7 @@ description: >
This Implementation Guide defines the Bangladesh Core FHIR profiles, This Implementation Guide defines the Bangladesh Core FHIR profiles,
value sets, code systems, and implementation rules for national digital health systems. value sets, code systems, and implementation rules for national digital health systems.
status: draft status: draft
version: 0.2.4 version: 0.2.5
fhirVersion: 4.0.1 fhirVersion: 4.0.1
copyrightYear: 2025+ copyrightYear: 2025+
releaseLabel: CI Build releaseLabel: CI Build