-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from devsticks/dev
v1.0.0
- Loading branch information
Showing
6 changed files
with
236 additions
and
141 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Deploy to GitHub Pages | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Flutter | ||
uses: subosito/flutter-action@v2 | ||
with: | ||
flutter-version: 'stable' | ||
|
||
- name: Run Makefile Deploy | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: make deploy OUTPUT=rostrem-website |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Makefile for deploying the Flutter web projects to GitHub | ||
# from https://codewithandrea.com/articles/flutter-web-github-pages/ | ||
|
||
BASE_HREF = /$(OUTPUT)/ | ||
GITHUB_USER = devsticks | ||
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 |
Oops, something went wrong.