Skip to content

Remove inline JS from Liquid template #56

Remove inline JS from Liquid template

Remove inline JS from Liquid template #56

Workflow file for this run

name: FHIR IG Auto-build
on:
push:
branches:
- '*'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Install graphviz (PlantUML dependency)
run: sudo apt-get install -y graphviz
- name: Cache contents of ~/.fhir
id: fhir-cache
uses: actions/cache@v3
with:
path: ~/.fhir
key: ${{ runner.os }}-fhir
# Makes Java available - see https://github.com/actions/setup-java
- uses: actions/setup-java@v3
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '11'
# Makes Ruby available for Jekyll - see https://github.com/ruby/setup-ruby
- name: Create Gemfile to cache Jekyll + dependencies
run: |
printf "source 'https://rubygems.org'\ngem 'jekyll'" > $GITHUB_WORKSPACE/Gemfile
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1' # Not needed with a .ruby-version file
bundler-cache: true
- name: Add Jekyll binary from Bundler to $PATH
run: |
bundle binstubs jekyll
echo "`pwd`/bin" >> $GITHUB_PATH
# Makes Node available for SUSHI - see https://github.com/actions/setup-node
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm install -g fsh-sushi
# Grab the latest version of the IG Publisher and stick in the right folder
- name: Download IG Publisher
run: mkdir -p $GITHUB_WORKSPACE/input-cache && curl -L https://github.com/HL7/fhir-ig-publisher/releases/latest/download/publisher.jar -o $GITHUB_WORKSPACE/input-cache/publisher.jar
# Run the IG publisher
- name: Run IG Publisher
run: java -Xmx4g -jar $GITHUB_WORKSPACE/input-cache/publisher.jar publisher -ig $GITHUB_WORKSPACE/ -tx n/a
# Deploy the output
- name: Push build to gh-pages (default branch)
if: ${{ github.ref == 'refs/heads/main' }}
run: |
# Deploy
git config --global user.email "[email protected]"
git config --global user.name "Auto-build"
git worktree add $GITHUB_WORKSPACE/../gh-pages
cd $GITHUB_WORKSPACE/../gh-pages
# Refresh in case another build has happened while this was running
# This mitigates a race condition with multiple simultaneous builds
git fetch origin
git reset --hard origin/gh-pages
mkdir -p branches
mv branches ..
rm -rf *
mv ../branches .
cp -r $GITHUB_WORKSPACE/output/* .
rm -rf .github/workflows
# Copy pages to make URLs like `https://terminology.smarthealth.cards/ValueSet/immunization-orthopoxvirus-all` resolve
mkdir ValueSet
find . -regex '\./ValueSet-[^.]*\.html$' -type f -exec bash -c 'cp "$0" "ValueSet/${0#./ValueSet-}" && mv "ValueSet/${0#./ValueSet-}" "ValueSet/${0#./ValueSet-}"' {} \;
find . -regex '\./ValueSet-[^.]*\.json$' -type f -exec bash -c 'cp "$0" "ValueSet/${0#./ValueSet-}" && mv "ValueSet/${0#./ValueSet-}" "ValueSet/${0#./ValueSet-}"' {} \;
find . -regex '\./ValueSet-[^.]*\.xml$' -type f -exec bash -c 'cp "$0" "ValueSet/${0#./ValueSet-}" && mv "ValueSet/${0#./ValueSet-}" "ValueSet/${0#./ValueSet-}"' {} \;
perl $GITHUB_WORKSPACE/script/fix_relative_paths.pl ValueSet # Touch up relative paths in the .html files
mkdir CodeSystem
find . -regex '\./CodeSystem-[^.]*\.html$' -type f -exec bash -c 'cp "$0" "CodeSystem/${0#./CodeSystem-}" && mv "CodeSystem/${0#./CodeSystem-}" "CodeSystem/${0#./CodeSystem-}"' {} \;
find . -regex '\./CodeSystem-[^.]*\.json$' -type f -exec bash -c 'cp "$0" "CodeSystem/${0#./CodeSystem-}" && mv "CodeSystem/${0#./CodeSystem-}" "CodeSystem/${0#./CodeSystem-}"' {} \;
find . -regex '\./CodeSystem-[^.]*\.xml$' -type f -exec bash -c 'cp "$0" "CodeSystem/${0#./CodeSystem-}" && mv "CodeSystem/${0#./CodeSystem-}" "CodeSystem/${0#./CodeSystem-}"' {} \;
perl $GITHUB_WORKSPACE/script/fix_relative_paths.pl CodeSystem # Touch up relative paths in the .html files
# Make IG canonical resolve
mkdir ImplementationGuide
cp ImplementationGuide-cards.smarthealth.terminology.xml ImplementationGuide/cards.smarthealth.terminology.xml
cp ImplementationGuide-cards.smarthealth.terminology.xml ImplementationGuide/cards.smarthealth.terminology.html
cp ImplementationGuide-cards.smarthealth.terminology.json ImplementationGuide/cards.smarthealth.terminology.json
echo "terminology.smarthealth.cards" > CNAME
git add -A
git commit --amend -m "Update site"
GIT_SSH_COMMAND='ssh -i ' git push -u --force origin gh-pages
- name: Push build to gh-pages (non-default branches)
if: ${{ github.ref != 'refs/heads/main' }}
run: |
# Deploy
git config --global user.email "[email protected]"
git config --global user.name "Auto-build"
git worktree add $GITHUB_WORKSPACE/../gh-pages
cd $GITHUB_WORKSPACE/../gh-pages
# Refresh in case another build has happened while this was running
# This mitigates a race condition with multiple simultaneous builds
git fetch origin
git reset --hard origin/gh-pages
mkdir -p branches/${GITHUB_REF##*/}
rm -rf branches/${GITHUB_REF##*/}/*
cp -r $GITHUB_WORKSPACE/output/* branches/${GITHUB_REF##*/}/
rm -rf .github/workflows
echo "terminology.smarthealth.cards" > CNAME
git add -A
git commit --amend -m "Update site"
GIT_SSH_COMMAND='ssh -i ' git push -u --force origin gh-pages