Closing issue #34 #26
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
# Main Workflow | |
# Trigger on every commit to staging | |
name: Copy Contents to main branch | |
on: | |
push: | |
branches: | |
- staging | |
pull_request: | |
branches: | |
- staging | |
workflow_dispatch: | |
jobs: | |
copy-theme-to-main: | |
name: Copy Themes content to main branch | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- name: Copy Files | |
env: | |
SRC_FOLDER_PATH: '.' | |
TARGET_BRANCH: 'main' | |
run: | | |
files=$(find $SRC_FOLDER_PATH -type f|grep -v 'resources\|git\|static\|content') # 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 | |
git add -A | |
git diff-index --quiet HEAD || git commit -am "Theme Files Update" # commit to the repository (ignore if no modification) | |
git push origin $TARGET_BRANCH # push to remote branch |