7676 fetch-tags : true
7777 persist-credentials : true
7878
79- - name : flatten-submodules
80- run : |
81- echo "Converting submodules to regular directories..."
82-
83- # Get list of submodules
84- git config --file .gitmodules --get-regexp path | awk '{ print $2 }' > /tmp/submodule_paths.txt
85-
86- # Remove each submodule from git's index (but keep the files)
87- while IFS= read -r submodule_path; do
88- if [ -d "$submodule_path" ]; then
89- echo "Removing submodule from index: $submodule_path"
90- git rm --cached "$submodule_path" || true
91- fi
92- done < /tmp/submodule_paths.txt
93-
94- # Remove .git directories from submodules (converts them to regular directories)
95- while IFS= read -r submodule_path; do
96- if [ -d "$submodule_path/.git" ]; then
97- echo "Removing .git directory: $submodule_path/.git"
98- rm -rf "$submodule_path/.git"
99- fi
100- done < /tmp/submodule_paths.txt
101-
102- # Remove submodule configuration
103- rm -f .gitmodules
104- git config --remove-section submodule.docs/notebooks || true
105- git config --remove-section submodule.docs/faq || true
106-
107- # Add submodule content back as regular files
108- while IFS= read -r submodule_path; do
109- if [ -d "$submodule_path" ]; then
110- echo "Adding submodule content as regular files: $submodule_path"
111- git add "$submodule_path/"
112- fi
113- done < /tmp/submodule_paths.txt
114-
115- # Stage removal of .gitmodules
116- git add .gitmodules || true
117-
118- # Configure git user for commit
119- git config user.name "github-actions[bot]"
120- git config user.email "github-actions[bot]@users.noreply.github.com"
121-
122- # Commit the flattened state
123- git commit -m "Flatten submodules for ReadTheDocs deployment" || echo "No changes to commit"
124-
125- echo "Submodules successfully flattened"
126-
12779 - name : push-mirror-repo
12880 id : sync-result
12981 env :
@@ -132,17 +84,18 @@ jobs:
13284 TARGET_REF : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target_ref || inputs.target_ref }}
13385 run : |
13486 echo "Source reference: $SOURCE_REF"
87+ git pull origin "$SOURCE_REF"
13588 git remote add mirror https://github.com/flexcompute-readthedocs/tidy3d-docs.git
136-
89+
13790 if [[ -n "$TARGET_REF" ]]; then
13891 echo "Pushing contents of '$SOURCE_REF' to remote ref '$TARGET_REF'."
139- git push mirror "HEAD :refs/heads/$TARGET_REF" --force
92+ git push mirror "$SOURCE_REF :refs/heads/$TARGET_REF" --force
14093 SYNCED_REF="$TARGET_REF"
14194 else
14295 echo "Pushing '$SOURCE_REF' to the same ref on the mirror."
143- git push mirror HEAD: "$SOURCE_REF" --force
96+ git push mirror "$SOURCE_REF" --force
14497 SYNCED_REF="$SOURCE_REF"
14598 fi
146-
99+
147100 echo "synced_ref=$SYNCED_REF" >> $GITHUB_OUTPUT
148101 echo "? Successfully synced to: $SYNCED_REF"
0 commit comments