Skip to content

Commit 2c6261a

Browse files
committed
Alternative approach
1 parent 60e2634 commit 2c6261a

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

deploy.sh

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,34 @@ if [[ "$BUILD_DIR" = false ]]; then
130130
echo "➤ Copying files..."
131131
if [[ -e "$GITHUB_WORKSPACE/.distignore" ]]; then
132132
echo "ℹ︎ Using .distignore"
133+
134+
# Deleting the git data so that the repo is reinitialized
135+
rm -rf "$GITHUB_WORKSPACE/.git"
136+
137+
# Removing the existing .gitignore file to replace it with the .distignore file
138+
rm "$GITHUB_WORKSPACE/.gitignore"
139+
140+
# Renaming the .distignore file to .gitignore
141+
cp "$GITHUB_WORKSPACE/.distignore" "$GITHUB_WORKSPACE/.gitignore"
142+
143+
cd "$GITHUB_WORKSPACE"
144+
145+
# Initializing the git repo for the new .gitignore file to be taken into account
146+
git init
147+
148+
git add . > /dev/null 2>&1
149+
150+
# Get the list files to be copied into a txt file.
151+
git ls-files > included-files.txt
152+
153+
# Return to the SVN dir.
154+
cd "$SVN_DIR"
155+
133156
# Copy from current branch to /trunk, excluding dotorg assets
134-
# The --filter flag will allow the full .gitignore syntax to be used in .distignore
157+
# The --files-from flag will only copy files from the included files list
135158
# The --delete flag will delete anything in destination that no longer exists in source
136159
# The --itemize-changes flag will show the changes made to each file
137-
rsync -rcv --filter="merge,- $GITHUB_WORKSPACE/.distignore" "$GITHUB_WORKSPACE/" trunk/ --delete --itemize-changes
160+
rsync -rcv --files-from="$GITHUB_WORKSPACE/included-files.txt" "$GITHUB_WORKSPACE/" trunk/ --delete --itemize-changes
138161
else
139162
echo "ℹ︎ Using .gitattributes"
140163

0 commit comments

Comments
 (0)