Skip to content

Commit

Permalink
proper setup
Browse files Browse the repository at this point in the history
  • Loading branch information
costateixeira committed Sep 23, 2023
1 parent 5ae060a commit 5ec9984
Show file tree
Hide file tree
Showing 12 changed files with 638 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: ReleaseBuld

on:
push:
branches-ignore:
- 'gh-pages'
pull_request:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
container:
image: hl7fhir/ig-publisher-base:latest
steps:
- name: Gather prerequisites
run: >
gosu publisher /home/publisher/bin/with-latest-sushi.sh &&
curl -L https://github.com/HL7/fhir-ig-publisher/releases/latest/download/publisher.jar -o "./publisher.jar" --create-dirs
- name: Checkout current repo to ./source
uses: actions/checkout@v2
with:
# repository: medigree/core
path: source

- name: Checkout HL7/fhir-ig-history-template to ./history-template
uses: actions/checkout@v2
with:
repository: HL7/fhir-ig-history-template
path: history-template

- name: Checkout medigree/smart-releases to ./webroot
uses: actions/checkout@v2
with:
repository: medigree/smart-releases
path: webroot

- name: Checkout FHIR/ig-registry to ./ig-registry
uses: actions/checkout@v2
with:
repository: FHIR/ig-registry
path: ig-registry

- name: Create folder
uses: docker://hl7fhir/ig-publisher-base:latest
with:
entrypoint: /bin/sh
args: -c "mkdir -p ./fhir-package-cache && chown 1001:127 ./fhir-package-cache"

- name: Run publisher command
run: java -jar ./publisher.jar publisher -ig core -package-cache-folder ./fhir-package-cache

- name: Run publisher command for publishing release
run: java -Dfile.encoding=UTF-8 -jar publisher.jar -go-publish -package-cache-folder ./fhir-package-cache -source source -web $(pwd)/webroot -registry ./ig-registry/fhir-ig-list.json -history ./history-template -templates $(pwd)/webroot/templates


- name: Deploy main
uses: JamesIves/[email protected]
# if: ${{ steps.branch-name.outputs.is_default }} == 'true'
with:
branch: gh-pages # The branch the action should deploy to.
folder: ./webroot # The folder the action should deploy.
target-folder: website
commit-message: Deploy website preview
single-commit: true
clean-exclude: branches
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
temp
webroot/temp
webroot/ddcc
webroot/ig-build-zips
webroot/publish-counter.json
241 changes: 241 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>FHIR Implementation Guides</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link rel="stylesheet" href="styles.css">
<link rel="stylesheet" type="text/css"
href="https://cdn.datatables.net/v/dt/jq-3.6.0/dt-1.11.5/datatables.min.css" />
<script type="text/javascript" src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/v/dt/jq-3.6.0/dt-1.11.5/datatables.min.js"></script>

</head>


<body>
<div class="container-fluid">
<div class="semi-transparent">
<div class="d-flex justify-content-between align-items-start">
<a href="http://hl7belgium.org">
<img src="hl7be-logo.png" alt="HL7 Belgium" height="100" />
</a>
<a href="http://hl7.org/fhir">
<img src="fhir-logo.png" alt="FHIR" height="100" />
</a>
</div>

<div class="text-center mt-3">
<h3>HL7 Belgium FHIR Community Specifications</h3>
<p>
These are the FHIR Implementation Guides that are validated and published for the Belgian community.
These are complementary to the official Implementation Guides published by the Federal eHealth
agency, which can be found <a href="https://ehealth.fgov.be/standards/fhir">here</a>.
</p>
<br />
<h2 style="text-align: left;">FHIR Specifications</h2>
</div>

<!-- Tab navigation -->
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link active nav-tab custom-nav-tab" id="ig-list-tab" data-target="packageInfo">IG
List</a>
</li>
<li class="nav-item">
<a class="nav-link nav-tab custom-nav-tab" id="artifacts-tab" data-target="artifacts">Artifacts</a>
</li>
</ul>


<!-- Tab content -->
<div class="tab-content">
<!-- Package Information -->
<div id="packageInfo" class="row row-cols-1 row-cols-md-1 gx-4"></div>
<!-- Artifacts -->
<div id="artifacts" class="d-none">
<br />
<p> This is a list of all artifacts published across all Implementation Guides:</p>
<br />
<table id="artifacts-table" class="display">
<thead>
<tr>
<th>Id</th>
<th>Type</th>
<th>Name</th>
<th>Version</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>

</div>
</div>

<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js"
integrity="sha256-3jOxLI54oGxS0Jpay+dHb/IyKbRloIzKq6/VBLBVc+A=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.1.3/js/bootstrap.min.js"
integrity="sha512-OvBgP9A2JBgiRad/mM36mkzXSXaJE9BEIENnVEmeZdITvwT09xnxLtT4twkCa8m/loMbPHsvPl0T8lRGVBwjlQ=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script>


async function fetchJSON(url) {
const response = await fetch(url);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return await response.json();
}

const showTable = getComputedStyle(document.documentElement).getPropertyValue('--show-table').trim();
if (showTable === 'true') {
document.body.classList.add('show-table');
}

document.addEventListener('DOMContentLoaded', () => {
const tabs = document.querySelectorAll('.nav-tab');
const tabContent = document.querySelectorAll('.tab-content > div');

function changeTab(e) {
e.preventDefault();
tabs.forEach(tab => {
tab.classList.remove('active');
});
e.target.classList.add('active');

const targetContent = e.target.getAttribute('data-target');

tabContent.forEach(content => {
if (content.id === targetContent) {
content.classList.remove('d-none');
} else {
content.classList.add('d-none');
}
});
}


tabs.forEach(tab => {
tab.addEventListener('click', changeTab);
});


// Initialize the DataTable with search enabled
$('#artifacts-table').DataTable({
searching: true,
});

// Initialize the DataTable with search enabled and custom data loading
const artifactsTable = $('#artifacts-table').DataTable({
destroy: true,
searching: true,
columns: [
{ data: 'id', render: (data, type, row) => `<a href="${row.url}">${data}</a>` },
{ data: 'type' },
{ data: 'name' },
{ data: 'version' },
],
});



(async function () {
const publishSetup = await fetchJSON('publish-setup.json');
const websiteUrl = publishSetup.website.url;

// Fetch and load the package information
async function loadPackageInfo() {
try {
const packageRegistry = await fetchJSON('package-registry.json');
const packageInfoContainer = document.getElementById('packageInfo');

for (const pkg of packageRegistry.packages) {
const packageListURL = getRelativePath(pkg.path, websiteUrl);
const packageList = await fetchJSON(packageListURL);

const title = packageList.title.trim();
const description = packageList.introduction.trim();

const latestEntry = packageList.list.find(entry => entry.status !== 'ci-build' && entry.current === true);
const ciEntry = packageList.list.find(item => item.status === 'ci-build');
const repo = ciEntry.path.substring(ciEntry.path.lastIndexOf("/") + 1);
const org = ciEntry.path.split("/")[ciEntry.path.split("/").length - 2];

const packageDiv = document.createElement('div');
packageDiv.classList.add('col');
packageDiv.innerHTML = `
<div class="card full-width">
<div class="card-body">
<h2 class="card-title">${title}</h2>
<p class="card-text">${description}</p>
</div>
<div class="card-footer d-flex justify-content-end">
<a href="${packageList.canonical}" class="btn btn-primary me-3 discrete-button">Implementation Guide</a>
<a href="${ciEntry.path}" class="btn btn-primary me-3 discrete-button">Current Development Version</a> <!-- New button -->
<a href="https://github.com/${org}/${repo}" class="btn btn-primary me-3 discrete-button">GitHub</a>
<a href="${packageList.canonical}/history.html" class="btn btn-primary discrete-button">Publication History</a>
</div>
</div>
`;
packageInfoContainer.appendChild(packageDiv);
}
} catch (error) {
console.error('Error fetching package information:', error);
}
}


// Fetch and load the artifact information
async function loadArtifacts() {
try {
const packageRegistry = await fetchJSON('package-registry.json');
const artifactsTable = $('#artifacts-table').DataTable({
destroy: true,
searching: true,
columns: [
{ data: 'id', render: (data, type, row) => `<a href="${row.url}">${data}</a>` },
{ data: 'type' },
{ data: 'name' },
{ data: 'version' },
],
});

for (const pkg of packageRegistry.packages) {
const packageListURL = getRelativePath(pkg.path, websiteUrl);
const packageList = await fetchJSON(packageListURL);

const canonicalsURL = packageList.list.find(entry => entry.status !== 'ci-build').path;
const relCanonicalsURL = getRelativePath(canonicalsURL, websiteUrl);
console.log(relCanonicalsURL);

const canonicals = await fetchJSON('.' + relCanonicalsURL + "/canonicals.json");
artifactsTable.rows.add(canonicals).draw();
}
} catch (error) {
console.error('Error fetching artifact information:', error);
}
}

function getRelativePath(path, websiteUrl) {
const cleanedPath = path.replace(/\/$/, ''); // Remove trailing slash
const cleanedWebsiteUrl = websiteUrl.replace(/\/$/, ''); // Remove trailing slash

const relativePath = cleanedPath.replace(cleanedWebsiteUrl, '');
return relativePath;
}

// Call the functions
loadPackageInfo();
loadArtifacts();
})();

});

</script>
</body>
Binary file added leftlogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions package-registry.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
14 changes: 14 additions & 0 deletions publish-setup.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"website" : {
"style" : "fhir.layout",
"url" : "https://smart.who.int/ig",
"server" : "apache",
"org" : "WHO",
"index-template":"index.template"
},
"layout-rules" : [{
"npm" : "who.smart.*",
"canonical" : "https://smart.who.int/ig/{3}",
"destination" : "/{3}"
}]
}
2 changes: 2 additions & 0 deletions publish.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
REM Test release publication
java -Dfile.encoding=UTF-8 -jar ../src/publisher.jar -go-publish -source ../src/smart-base -web %CD%/webroot -temp %CD%/temp -registry ../ig-registry/fhir-ig-list.json -history ../ig-history -templates %CD%/webroot/templates
Binary file added rightlogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 5ec9984

Please sign in to comment.