cd: add hosted server configurations in workflow

This commit is contained in:
Kingkor Roy Tirtho 2023-02-03 17:10:41 +06:00
parent 24d7b5b851
commit 1956692484
3 changed files with 16 additions and 12 deletions

View File

@ -28,7 +28,7 @@ jobs:
curl -sS https://webi.sh/yq | sh curl -sS https://webi.sh/yq | sh
yq -i '.version |= sub("\+\d+", "-nightly-")' pubspec.yaml yq -i '.version |= sub("\+\d+", "-nightly-")' pubspec.yaml
yq -i '.version += strenv(GITHUB_RUN_NUMBER)' pubspec.yaml yq -i '.version += strenv(GITHUB_RUN_NUMBER)' pubspec.yaml
echo '${{ secrets.DOT_ENV }}' > .env echo '${{ secrets.DOTENV_NIGHTLY }}' > .env
flutter config --enable-linux-desktop flutter config --enable-linux-desktop
flutter pub get flutter pub get
dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}' dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}'
@ -64,7 +64,7 @@ jobs:
curl -sS https://webi.sh/yq | sh curl -sS https://webi.sh/yq | sh
yq -i '.version |= sub("\+\d+", "-nightly-")' pubspec.yaml yq -i '.version |= sub("\+\d+", "-nightly-")' pubspec.yaml
yq -i '.version += strenv(GITHUB_RUN_NUMBER)' pubspec.yaml yq -i '.version += strenv(GITHUB_RUN_NUMBER)' pubspec.yaml
echo '${{ secrets.DOT_ENV }}' > .env echo '${{ secrets.DOTENV_NIGHTLY }}' > .env
flutter pub get flutter pub get
dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}' dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}'
echo '${{ secrets.KEYSTORE }}' | base64 --decode > android/app/upload-keystore.jks echo '${{ secrets.KEYSTORE }}' | base64 --decode > android/app/upload-keystore.jks
@ -95,7 +95,7 @@ jobs:
yq -i '.version |= sub("\+\d+", "-nightly-")' pubspec.yaml yq -i '.version |= sub("\+\d+", "-nightly-")' pubspec.yaml
yq -i '.version += strenv(GITHUB_RUN_NUMBER)' pubspec.yaml yq -i '.version += strenv(GITHUB_RUN_NUMBER)' pubspec.yaml
sed -i "s/%{{SPOTUBE_VERSION}}%/${{ env.GITHUB_RUN_NUMBER }}/" windows/runner/Runner.rc sed -i "s/%{{SPOTUBE_VERSION}}%/${{ env.GITHUB_RUN_NUMBER }}/" windows/runner/Runner.rc
echo '${{ secrets.DOT_ENV }}' > .env echo '${{ secrets.DOTENV_NIGHTLY }}' > .env
flutter config --enable-windows-desktop flutter config --enable-windows-desktop
flutter pub get flutter pub get
dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}' dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}'
@ -123,7 +123,7 @@ jobs:
- run: brew install yq - run: brew install yq
- run: yq -i '.version |= sub("\+\d+", "-nightly-")' pubspec.yaml - run: yq -i '.version |= sub("\+\d+", "-nightly-")' pubspec.yaml
- run: yq -i '.version += strenv(GITHUB_RUN_NUMBER)' pubspec.yaml - run: yq -i '.version += strenv(GITHUB_RUN_NUMBER)' pubspec.yaml
- run: echo '${{ secrets.DOT_ENV }}' > .env - run: echo '${{ secrets.DOTENV_NIGHTLY }}' > .env
- run: flutter config --enable-macos-desktop - run: flutter config --enable-macos-desktop
- run: flutter pub get - run: flutter pub get
- run: dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}' - run: dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}'

View File

@ -31,7 +31,7 @@ jobs:
with: with:
cache: true cache: true
- run: | - run: |
echo '${{ secrets.DOT_ENV }}' > .env echo '${{ secrets.DOTENV_RELEASE }}' > .env
flutter config --enable-windows-desktop flutter config --enable-windows-desktop
flutter pub get flutter pub get
dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}' dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}'
@ -73,7 +73,7 @@ jobs:
- uses: subosito/flutter-action@v2.8.0 - uses: subosito/flutter-action@v2.8.0
with: with:
cache: true cache: true
- run: echo '${{ secrets.DOT_ENV }}' > .env - run: echo '${{ secrets.DOTENV_RELEASE }}' > .env
- run: flutter config --enable-macos-desktop - run: flutter config --enable-macos-desktop
- run: flutter pub get - run: flutter pub get
- run: dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}' - run: dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}'
@ -114,7 +114,7 @@ jobs:
# replacing & adding new release version with older version # replacing & adding new release version with older version
- run: | - run: |
sed -i 's|%{{APPDATA_RELEASE}}%|<release version="${{ steps.tag.outputs.tag }}" date="${{ steps.date.outputs.date }}" />|' linux/com.github.KRTirtho.Spotube.appdata.xml sed -i 's|%{{APPDATA_RELEASE}}%|<release version="${{ steps.tag.outputs.tag }}" date="${{ steps.date.outputs.date }}" />|' linux/com.github.KRTirtho.Spotube.appdata.xml
echo '${{ secrets.DOT_ENV }}' > .env echo '${{ secrets.DOTENV_RELEASE }}' > .env
- run: | - run: |
flutter config --enable-linux-desktop flutter config --enable-linux-desktop
@ -149,7 +149,7 @@ jobs:
sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev make python3-pip python3-setuptools patchelf desktop-file-utils libgdk-pixbuf2.0-dev fakeroot strace fuse sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev make python3-pip python3-setuptools patchelf desktop-file-utils libgdk-pixbuf2.0-dev fakeroot strace fuse
- run: | - run: |
echo '${{ secrets.DOT_ENV }}' > .env echo '${{ secrets.DOTENV_RELEASE }}' > .env
flutter pub get flutter pub get
dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}' dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}'
echo '${{ secrets.KEYSTORE }}' | base64 --decode > android/app/upload-keystore.jks echo '${{ secrets.KEYSTORE }}' | base64 --decode > android/app/upload-keystore.jks

View File

@ -1,11 +1,15 @@
import 'package:flutter/foundation.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart';
abstract class Env { abstract class Env {
static final String pocketbaseUrl = dotenv.get('POCKETBASE_URL'); static final String pocketbaseUrl =
static final String username = dotenv.get('USERNAME'); dotenv.get('POCKETBASE_URL', fallback: 'http://localhost:8090');
static final String password = dotenv.get('PASSWORD'); static final String username = dotenv.get('USERNAME', fallback: 'root');
static final String password = dotenv.get('PASSWORD', fallback: '12345678');
static configure() async { static configure() async {
await dotenv.load(fileName: ".env"); if (kReleaseMode) {
await dotenv.load(fileName: ".env");
}
} }
} }