Skip to content

Commit

Permalink
Cleanup unused shell script
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverRainZ committed Dec 4, 2022
1 parent a3ea9f4 commit fdbc74c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 42 deletions.
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ runs:
python-version: '3.10'
cache: 'pip'

- name: Setup cache
- name: Restore cache
uses: actions/cache@v3
if: ${{ inputs.cache == 'true' }}
with:
Expand All @@ -76,7 +76,7 @@ runs:
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: '.' # Upload entire repository
path: /tmp/sphinxnotes-pages

- name: Deploy to GitHub Pages
id: deployment
Expand Down
40 changes: 0 additions & 40 deletions main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,43 +87,3 @@ if ! sphinx-build -b html "$doc_dir" "$build_dir"; then
exit 1
fi
echo ::endgroup::

echo ::group:: Setting up git repository
echo Setting up git configure
cd $repo_dir
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git stash
echo Setting up branch $INPUT_TARGET_BRANCH
branch_exist=$(git ls-remote --heads origin refs/heads/$INPUT_TARGET_BRANCH)
if [ -z "$branch_exist" ]; then
echo Branch doesn\'t exist, create an empty branch
git checkout --force --orphan $INPUT_TARGET_BRANCH
else
echo Branch exists, checkout to it
git checkout --force $INPUT_TARGET_BRANCH
fi
git clean -fd
echo ::endgroup::

echo ::group:: Committing HTML documentation
cd $repo_dir
echo Cleanup files in repository
# Enable extglob for !("xxx") pattern support
shopt -s extglob
rm -vrf !("CNAME"|".nojekyll"|"robots.txt")
shopt -u extglob
echo Copying HTML documentation to repository
cp -vr $build_dir/. $INPUT_TARGET_PATH
# Remove unused doctree
rm -rf $INPUT_TARGET_PATH/.doctrees
if [ ! -f "$INPUT_TARGET_PATH/.nojekyll" ]; then
# See also sphinxnotes/pages#7
echo Creating .nojekyll file
touch "$INPUT_TARGET_PATH/.nojekyll"
fi
echo Adding HTML documentation to repository index
git add $INPUT_TARGET_PATH
echo Recording changes to repository
git commit --allow-empty -m "Add changes for $GITHUB_SHA"
echo ::endgroup::

0 comments on commit fdbc74c

Please sign in to comment.