Update make_docs.yml #111
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Copy folder to other branch | |
on: [push] | |
jobs: | |
copy: | |
name: Copy my folder | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: copy | |
env: | |
SRC_FOLDER_PATH: 'doc/build' | |
TARGET_BRANCH: 'gh-pages' | |
if: github.ref == 'refs/heads/develop' | |
run: | | |
files=$(find $SRC_FOLDER_PATH -type f) # get the file list | |
git config --global user.name 'GitHub Action' | |
git config --global user.email '[email protected]' | |
git fetch # fetch branches | |
git checkout $TARGET_BRANCH # checkout to your branch | |
git checkout ${GITHUB_REF##*/} -- $files # copy files from the source branch | |
echo "the folders before move" | |
ls ${{ github.workspace }} | |
cp -rf doc/build/* docs/ | |
rm -rf doc | |
echo "folders after move" | |
ls ${{ github.workspace }} | |
git status | |
git add -A | |
git commit -m "deploy files" # commit to the repository (ignore if no modification) | |
git push origin $TARGET_BRANCH # push to remote branch |