-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
41 lines (31 loc) · 1.09 KB
/
Makefile
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
# Makefile for deploying the Flutter web projects to GitHub
BASE_HREF = /$(OUTPUT)/
# Replace this with your GitHub username
GITHUB_USER = Ericles-Porty
GITHUB_REPO = /~https://github.com/$(GITHUB_USER)/$(OUTPUT)
BUILD_VERSION := $(shell grep 'version:' pubspec.yaml | awk '{print $$2}')
# Deploy the Flutter web project to GitHub
deploy:
ifndef OUTPUT
$(error OUTPUT is not set. Usage: make deploy OUTPUT=<output_repo_name>)
endif
@echo "Clean existing repository"
flutter clean
@echo "Getting packages..."
flutter pub get
@echo "Generating the web folder..."
flutter create . --platform web
@echo "Building for web..."
flutter build web --base-href $(BASE_HREF) --release
@echo "Deploying to git repository"
cd build/web && \
git init && \
git add . && \
git commit -m "Deploy Version $(BUILD_VERSION)" && \
git branch -M main && \
git remote add origin $(GITHUB_REPO) && \
git push -u -f origin main
@echo "✅ Finished deploy: $(GITHUB_REPO)"
@echo "🚀 Flutter web URL: https://$(GITHUB_USER).github.io/$(OUTPUT)/"
.PHONY: deploy
# example: make deploy OUTPUT=Updater_Project_Deploy_Test