Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
eeceb706d6 | |||
165efcd1a3 | |||
509849db5b | |||
82f8748177 | |||
8fd0511242 |
@@ -33,8 +33,8 @@ class MyApp extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
textTheme: const TextTheme(
|
textTheme: const TextTheme(
|
||||||
titleLarge: TextStyle(fontSize: 30, fontWeight: FontWeight.bold),
|
titleLarge: TextStyle(fontSize: 30, fontWeight: FontWeight.bold),
|
||||||
bodyLarge: TextStyle(fontSize: 18),
|
bodyLarge: TextStyle(fontSize: 20),
|
||||||
bodyMedium: TextStyle(fontSize: 16),
|
bodyMedium: TextStyle(fontSize: 20),
|
||||||
bodySmall: TextStyle(fontSize: 14),
|
bodySmall: TextStyle(fontSize: 14),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -63,6 +63,14 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
|
|
||||||
Future<void> _refreshGames() async {
|
Future<void> _refreshGames() async {
|
||||||
final games = await GameRepository.getAll();
|
final games = await GameRepository.getAll();
|
||||||
|
games.forEach((key, game) {
|
||||||
|
game.updateActualVersion().then((_) {
|
||||||
|
GameRepository.upsert(game);
|
||||||
|
setState(() {
|
||||||
|
games[game.name] = game;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
setState(() {
|
setState(() {
|
||||||
this.games = games;
|
this.games = games;
|
||||||
});
|
});
|
||||||
@@ -91,7 +99,8 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: i < games.length
|
child:
|
||||||
|
i < games.length
|
||||||
? GameCard(
|
? GameCard(
|
||||||
game: games.values.elementAt(i),
|
game: games.values.elementAt(i),
|
||||||
onGameUpdated: (game) async {
|
onGameUpdated: (game) async {
|
||||||
@@ -101,9 +110,13 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
onDelete: () async {
|
onDelete: () async {
|
||||||
await GameRepository.delete(games.values.elementAt(i));
|
await GameRepository.delete(
|
||||||
|
games.values.elementAt(i),
|
||||||
|
);
|
||||||
setState(() {
|
setState(() {
|
||||||
games.remove(games.values.elementAt(i).name);
|
games.remove(
|
||||||
|
games.values.elementAt(i).name,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@@ -118,7 +131,8 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
),
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: i + 1 < games.length
|
child:
|
||||||
|
i + 1 < games.length
|
||||||
? GameCard(
|
? GameCard(
|
||||||
game: games.values.elementAt(i + 1),
|
game: games.values.elementAt(i + 1),
|
||||||
onGameUpdated: (game) async {
|
onGameUpdated: (game) async {
|
||||||
@@ -128,9 +142,13 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
onDelete: () async {
|
onDelete: () async {
|
||||||
await GameRepository.delete(games.values.elementAt(i + 1));
|
await GameRepository.delete(
|
||||||
|
games.values.elementAt(i + 1),
|
||||||
|
);
|
||||||
setState(() {
|
setState(() {
|
||||||
games.remove(games.values.elementAt(i + 1).name);
|
games.remove(
|
||||||
|
games.values.elementAt(i + 1).name,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@@ -267,7 +267,7 @@ class _GameCardState extends State<GameCard>
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 120,
|
width: 200,
|
||||||
child: Text(
|
child: Text(
|
||||||
'Version:',
|
'Version:',
|
||||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||||
@@ -290,7 +290,7 @@ class _GameCardState extends State<GameCard>
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 120,
|
width: 200,
|
||||||
child: Text(
|
child: Text(
|
||||||
'Last Updated:',
|
'Last Updated:',
|
||||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||||
@@ -312,7 +312,7 @@ class _GameCardState extends State<GameCard>
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 120,
|
width: 200,
|
||||||
child: Text(
|
child: Text(
|
||||||
'Last Played:',
|
'Last Played:',
|
||||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||||
|
62
release.sh
Normal file
62
release.sh
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Determine the tag
|
||||||
|
echo "Figuring out the tag..."
|
||||||
|
TAG=$(git describe --tags --exact-match 2>/dev/null || echo "")
|
||||||
|
if [ -z "$TAG" ]; then
|
||||||
|
# Get the latest tag
|
||||||
|
LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
|
||||||
|
# Increment the patch version
|
||||||
|
IFS='.' read -r -a VERSION_PARTS <<< "$LATEST_TAG"
|
||||||
|
VERSION_PARTS[2]=$((VERSION_PARTS[2]+1))
|
||||||
|
TAG="${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.${VERSION_PARTS[2]}"
|
||||||
|
# Create a new tag
|
||||||
|
git tag $TAG
|
||||||
|
git push origin $TAG
|
||||||
|
fi
|
||||||
|
echo "Tag: $TAG"
|
||||||
|
|
||||||
|
# Build the application
|
||||||
|
echo "Building the thing..."
|
||||||
|
flutter build windows --release
|
||||||
|
flutter build apk --release
|
||||||
|
|
||||||
|
echo "Creating a release..."
|
||||||
|
TOKEN="$GITEA_API_KEY"
|
||||||
|
GITEA="https://git.site.quack-lab.dev"
|
||||||
|
REPO="dave/flutter-gamer-updater"
|
||||||
|
ZIP="gamer-updater-${TAG}.zip"
|
||||||
|
APK="gamer-updater-${TAG}.apk"
|
||||||
|
# Create a release
|
||||||
|
RELEASE_RESPONSE=$(curl -s -X POST \
|
||||||
|
-H "Authorization: token $TOKEN" \
|
||||||
|
-H "Accept: application/json" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d '{
|
||||||
|
"tag_name": "'"$TAG"'",
|
||||||
|
"name": "'"$TAG"'",
|
||||||
|
"draft": false,
|
||||||
|
"prerelease": false
|
||||||
|
}' \
|
||||||
|
$GITEA/api/v1/repos/$REPO/releases)
|
||||||
|
|
||||||
|
# Extract the release ID
|
||||||
|
echo $RELEASE_RESPONSE
|
||||||
|
RELEASE_ID=$(echo $RELEASE_RESPONSE | awk -F'"id":' '{print $2+0; exit}')
|
||||||
|
echo "Release ID: $RELEASE_ID"
|
||||||
|
|
||||||
|
echo "Uploading the things..."
|
||||||
|
WINRELEASE="./build/windows/x64/runner/Release/"
|
||||||
|
7z a $WINRELEASE/$ZIP $WINRELEASE/*
|
||||||
|
curl -X POST \
|
||||||
|
-H "Authorization: token $TOKEN" \
|
||||||
|
-F "attachment=@$WINRELEASE/$ZIP" \
|
||||||
|
"$GITEA/api/v1/repos/$REPO/releases/${RELEASE_ID}/assets?name=$ZIP"
|
||||||
|
rm $WINRELEASE/$ZIP
|
||||||
|
|
||||||
|
ANDROIDRELEASE="./build/app/outputs/flutter-apk/"
|
||||||
|
mv $ANDROIDRELEASE/app-release.apk $ANDROIDRELEASE/$APK
|
||||||
|
curl -X POST \
|
||||||
|
-H "Authorization: token $TOKEN" \
|
||||||
|
-F "attachment=@$ANDROIDRELEASE/$APK" \
|
||||||
|
"$GITEA/api/v1/repos/$REPO/releases/${RELEASE_ID}/assets?name=$APK"
|
Reference in New Issue
Block a user