-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeployment.sh
More file actions
executable file
·47 lines (35 loc) · 985 Bytes
/
deployment.sh
File metadata and controls
executable file
·47 lines (35 loc) · 985 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
set -e
BUILD_DIRECTORY="build/web"
DEPLOY_DIRECTORY="docs"
COMMIT_MESSAGE="Deploy On Pages"
BASE_HREF="/flutter-playground/"
build_flutter_web() {
echo "Building Web application..."
rm -rf "$BUILD_DIRECTORY"
if ! flutter build web \
--base-href=$BASE_HREF \
--release; then
echo "Flutter build failed"
exit 1
fi
}
deploy_to_pages() {
echo "Deploying to GitHub Pages..."
mkdir -p "$DEPLOY_DIRECTORY"
rm -rf "${DEPLOY_DIRECTORY:?}/"*
if ! cp -r "$BUILD_DIRECTORY"/* "$DEPLOY_DIRECTORY"; then
echo "Failed to copy build files"
exit 1
fi
if git add .; then
git commit -m "$COMMIT_MESSAGE" && git push
else
echo "Git operations failed"
exit 1
fi
echo "Deployment completed successfully!"
echo "Please ensure GitHub Pages is configured to serve from the $DEPLOY_DIRECTORY folder"
}
build_flutter_web
deploy_to_pages