diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0eef0ed..9b727cf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,20 +37,20 @@ jobs: run: echo ${GITHUB_REF##*/} # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v3 -# - name: Create gh-pages branch if it doesn't exist -# run: | -# git fetch origin -# exists=`git show-ref refs/heads/gh-pages` -# if [ -n "$exists" ]; then -# echo 'gh-pages branch exists'; -# else -# echo 'gh-pages branch does not exist, creating it'; -# git checkout --orphan gh-pages -# git reset --hard -# git commit --allow-empty -m "Initializing gh-pages branch" -# git push origin gh-pages -# git checkout ${GITHUB_REF##*/} -# fi + - name: Create gh-pages branch if it doesn't exist + run: | + git fetch origin + exists=$(git ls-remote --heads origin gh-pages | wc -l) + if [ "$exists" -eq "0" ]; then + echo 'gh-pages branch does not exist, creating it' + git checkout --orphan gh-pages + git rm -rf . # Remove all files and directories from the orphaned branch + git commit --allow-empty -m "Initializing empty gh-pages branch" + git push origin gh-pages + else + echo 'gh-pages branch exists' + fi + - name: Update the image to the latest publisher uses: docker://hl7fhir/ig-publisher-base:latest with: