-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-ig-publisher.sh
More file actions
executable file
·53 lines (41 loc) · 1.91 KB
/
run-ig-publisher.sh
File metadata and controls
executable file
·53 lines (41 loc) · 1.91 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
#!/bin/bash
# This bash script is used to publish an Implementation Guide (IG) using the IG Publisher tool.
# The script requires two arguments: the target URL and the version of the IG.
# Depending on whether "-snapshot" is part of the version, the script will run an CI build or a release build.
if [ $# -eq 0 ]; then
echo "Error: Two arguments are required."
echo "Usage: $0 <targetUrl> <version>"
exit 1
fi
publisher_jar=publisher.jar
input_cache_path=./input-cache/
export JAVA_TOOL_OPTIONS="$JAVA_TOOL_OPTIONS -Dfile.encoding=UTF-8"
targetUrl=$1
version=$2
function set_release_label() {
local release_label=$1
local sushi_config_file="sushi-config.yaml"
if [ ! -f "$sushi_config_file" ]; then
echo "Error: File $sushi_config_file does not exist."
return 1
fi
sed -i "s/^releaseLabel: .*/releaseLabel: $release_label/g" "$sushi_config_file"
}
# download publisher
publisher=$input_cache_path/$publisher_jar
if ! test -f "$publisher"; then
echo "Downloading IG Publisher..."
curl -L https://github.com/HL7/fhir-ig-publisher/releases/latest/download/publisher.jar -o ./input-cache/publisher.jar --create-dirs
fi
if [[ "$version" == *"-snapshot"* ]]; then
# snapshot build
echo "Running snapshot build..."
set_release_label "ci-build" # the continuous integration build release (not stable); see #https://fshschool.org/docs/sushi/configuration/#fsh-and-ig-processing-minimum-configuration
java -jar $publisher -ig . $*
else
# release build
echo "Running release build..."
set_release_label "qa-preview" # frozen snapshot for non-ballot feedback; see #https://fshschool.org/docs/sushi/configuration/#fsh-and-ig-processing-minimum-configuration
java -jar $publisher -ig . -publish $targetUrl $*
find ./output -name "*.html" -exec sed -i "s/Publication Build: This will be filled in by the publication tooling/This page is part of the CPG-on-EBMonFHIR Implementation Guide ($version)./g" {} +
fi