Skip to content
This repository has been archived by the owner on Nov 18, 2024. It is now read-only.

Commit

Permalink
feat: Add release github action
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexisL61 committed Jun 19, 2024
1 parent 99286e8 commit 996af3c
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 6 deletions.
100 changes: 100 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Pre-release App
# You may pin to the exact commit or the version.
# uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa

on:
push:
branches: [ main ]

jobs:
retrievingVersion:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.versionstep.outputs.version }}
previousTag: ${{ steps.previousTag.outputs.previousTag }}
steps:
- uses: actions/checkout@v3
with:
fetch-tags: true
fetch-depth: 0
- name: Expose git commit data
uses: rlespinasse/git-commit-data-action@v1
- name: Retrieve Release Version
id: versionstep
working-directory: sot_richpresence
run: |
VERSION=$(more pubspec.yaml | grep version: | cut -d ' ' -f2)
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "VERSION=${VERSION}" >> $GITHUB_ENV
build_windows:
runs-on: windows-latest
needs: retrievingVersion
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.19.6'
channel: 'stable'
- name: Build windows
working-directory: ./sot_richpresence
run: flutter build windows --build-name ${{ needs.retrievingVersion.outputs.version }}
- uses: actions/upload-artifact@v3
with:
name: build_windows
path: ./sot_richpresence/build/windows/x64/runner/Release
build_linux:
runs-on: ubuntu-latest
needs: retrievingVersion
steps:
- uses: actions/checkout@v3
- run: |
sudo apt-get update -y
sudo apt install libmpv-dev mpv
sudo apt-get install -y ninja-build libgtk-3-dev
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.19.6'
channel: 'stable'
- name: Build linux
working-directory: ./sot_richpresence
run: flutter build linux --build-name ${{ needs.retrievingVersion.outputs.version }}
- uses: actions/upload-artifact@v3
with:
name: build_linux
path: ./sot_richpresence/build/linux/x64/release/bundle
upload:
runs-on: ubuntu-latest
needs:
- build_windows
- build_linux
- retrievingVersion
steps:
- uses: actions/checkout@v3
with:
ref: main
- run: mkdir -p dist
- uses: actions/download-artifact@v3
with:
name: build_windows
path: dist/SOT_RichPresence_Windows
- uses: actions/download-artifact@v3
with:
name: build_linux
path: dist/SOT_RichPresence_Linux
- name: Zipping windows release
working-directory: dist/SOT_RichPresence_Windows
run: |
zip -r ../../SOT_RichPresence_Windows.zip *
- name: Zipping linux release
working-directory: dist/SOT_RichPresence_Linux
run: |
zip -r ../../SOT_RichPresence_Linux.zip *
- name: Upload release onto Github
uses: ncipollo/release-action@v1
with:
artifacts: 'SOT_RichPresence_Windows.zip,SOT_RichPresence_Linux.zip'
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ needs.retrievingVersion.outputs.version }}
prerelease: false
allowUpdates: true

File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion sot_richpresence/lib/config.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
class Config {
static const String mainServer = "";
static const String apiLink =
"https://raw.githubusercontent.com/AlexisL61/SOT_RichPresence/main/api/v1";
}
13 changes: 8 additions & 5 deletions sot_richpresence/lib/services/api/api_service.dart
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
import 'dart:convert';

import 'package:http/http.dart';
import 'package:sot_richpresence/config.dart';
import 'package:sot_richpresence/models/activities/activity_company.dart';
import 'package:sot_richpresence/models/translations/available_translation.dart';

class ApiService {
static Future<List<AvailableTranslation>> fetchAvailableTranslations() async {
final response = await sendGetRequest('https://raw.githubusercontent.com/AlexisL61/SOT_RichPresence/main/api/translations/available_translations.json');
final response = await sendGetRequest(
'${Config.apiLink}/translations/available_translations.json');
if (response.statusCode == 200) {
return AvailableTranslation.fromJsonList(response.body);
} else {
throw Exception('Failed to load available translations');
}
}

static Future<Map<String, dynamic>> fetchSpecificTranslation(String translation) async {
final response = await sendGetRequest('https://raw.githubusercontent.com/AlexisL61/SOT_RichPresence/main/api/translations/'+translation+'.json');
static Future<Map<String, dynamic>> fetchSpecificTranslation(
String translation) async {
final response = await sendGetRequest(
'${Config.apiLink}/translations/' + translation + '.json');
if (response.statusCode == 200) {
return jsonDecode(response.body);
} else {
Expand All @@ -24,8 +28,7 @@ class ApiService {
}

static Future<List<ActivityCompany>> fetchActivityCategories() async {
final response =
await sendGetRequest('https://raw.githubusercontent.com/AlexisL61/SOT_RichPresence/main/api/activities.json');
final response = await sendGetRequest('${Config.apiLink}/activities.json');
if (response.statusCode == 200) {
return ActivityCompany.fromJsonList(response.body);
} else {
Expand Down

0 comments on commit 996af3c

Please sign in to comment.