git_stamp 4.5.0
git_stamp: ^4.5.0 copied to clipboard
Advanced await-less information provider. From simple information such as build-branch to a screen with Flutter code with commits and change history.
Git Stamp 🏷 #
Advanced await-less information provider. From simple information such as build-branch
to a screen with Flutter code with commits and change history. How it work?
Check out the Example of how Git Stamp is connected to Git Stamp Repo 🌀
Table of Contents
🏞️ Preview #
1. LITE & FULL
Light | Dark |
---|---|
![]() |
![]() |
2. ICON
3. Generator
📑️ About #
Goal
The main goal is to help locate errors in the full process of building STAGE, TEST and PROD versions.
Motivation
The main motivation was Minecraft with information like this:
Version: v1.20.81
Build: 24130126
Branch: r/20_u8
SHA: a9081c5429038dcf3f26269f7351d89f
Git Stamp code:
import 'git_stamp/git_stamp.dart';
Text('Version: ${GitStamp.appVersion}'),
Text('Build: ${GitStamp.appBuild}'),
Text('Branch: ${GitStamp.buildBranch}'),
Text('SHA: ${GitStamp.sha}'),
Roadmap
Changelogs
Text Image
🆕 Version | 🗓️ Date | 📝 Change Description |
---|---|---|
Version 5 | Someday it will be | 🔐 Data encription |
Version 4 | 24.07.2024 | 🌟 New icon build-type |
Version 3 | 30.06.2024 | 🔧 New gen-only build-type |
Version 2 | 10.04.2024 | 🛠️ Commit diff |
Version 1 | 11.12.2023 | 🚀 First version |
🛠️ Installation #
1. pubspec.yaml
dart pub add git_stamp
2. .gitignore
Important
Add git_stamp to .gitignore.
echo -e "\n/lib/git_stamp/" >> .gitignore
.
If you add a /git_stamp folder for the repository and use the FULL
version, the size of the repository will grow EXPONENTIALLY.
3. README.md
Warning
Add badge to your README.md
😄️
[](https://github.com/arononak/git_stamp)
🏗️ Generating #
1. Examples
Build type | Pure Dart | CLI Command |
---|---|---|
LITE | NO | dart run git_stamp |
FULL | NO | dart run git_stamp --build-type full |
ICON | NO | dart run git_stamp --build-type icon |
CUSTOM | YES | dart run git_stamp --gen-only build-branch,build-date-time |
2. Tip
Caution
Generating requires the use of the git
command-line interface (CLI).
3. Custom gen-only
parameters
commit-list
diff-list
repo-creation-date
build-branch
build-date-time
build-system-info
repo-path
observed-files-list
app-version
app-build
app-name
git-config
💻 Usage #
1. ListTile
if (kDebugMode) ...[
ListTile(
title: const Text('Git Stamp'),
subtitle: Text(GitStamp.sha),
leading: const Icon(Icons.commit),
onTap: () => showGitStampPage(context: context),
),
],
2. IconButton
if (isProd == false) ...[
IconButton(
onPressed: () => showGitStampPage(context: context),
icon: const Icon(Icons.book),
),
],
3. showGitStampLicensePage()
Note
Use function GitStamp.showLicensePage
instead of showLicensePage
if you want the name
and version
to be added automatically.
4. Central GitStamp node for advanced usage:
class GitStamp {
static List<GitStampCommit> commitList
static GitStampCommit? latestCommit
static String sha
static const Map<String, String> diffList
static const String buildBranch
static const String buildDateTime
static const String buildSystemInfo
static const String repoCreationDate
static const String repoPath
static const String observedFilesList
static const String appVersion
static const String appBuild
static const String appName
static const String gitConfigGlobalUserName
static const String gitConfigGlobalUserEmail
static const String gitConfigUserName
static const String gitConfigUserEmail
static showLicensePage({
required BuildContext context,
Widget? applicationIcon,
String? applicationLegalese,
bool useRootNavigator = false,
})
}
📦 Integration #
GitHub Actions
.github/workflows/build_and_deploy.yml
name: build_and_deploy
on:
push:
branches: [main]
pull_request_target:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.22.2'
channel: 'stable'
- run: flutter --version
- uses: actions/setup-java@v1
with:
java-version: "12.x"
- run: flutter pub get
- run: dart run git_stamp
- run: flutter build web --release --web-renderer canvaskit
- uses: actions/upload-artifact@master
with:
name: build
path: build/web
deploy:
name: "Deploy"
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@master
with:
name: build
path: build/web
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT }}"
projectId: xxx
channelId: live
📝 License #
Note
Copyright © 2024 Aron Onak. All rights reserved.
Licensed under the MIT license.
If you have any feedback, please contact me at arononak@gmail.com