Skip to content

ci: Create Website Build Workflow #157

ci: Create Website Build Workflow

ci: Create Website Build Workflow #157

Workflow file for this run

name: Nightly Build
on:
workflow_dispatch:
push:
branches: ["main"]
paths-ignore:
- "*.md"
- "docs/**"
jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version-file: pubspec.yaml
cache: true
- run: echo '### 🔬Test Results' >> $GITHUB_STEP_SUMMARY
- run: flutter pub get && flutter test -r github >> $GITHUB_STEP_SUMMARY
build-android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version-file: pubspec.yaml
cache: true
- name: Attach Commit ID to Version
run: |
# Retrieve the current commit hash
COMMIT_HASH=$(git rev-parse --short HEAD)
# Retrieve the current version from pubspec.yaml
CURRENT_VERSION=$(grep '^version:' pubspec.yaml | sed 's/version: //')
# Combine the version and commit hash
NEW_VERSION=$(echo $CURRENT_VERSION | sed "s/+/-$COMMIT_HASH+/")
# Update the version in pubspec.yaml
sed -i "s/^version: .*/version: $NEW_VERSION/" pubspec.yaml
# Validate
cat pubspec.yaml | grep '^version:'
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: "17"
cache: gradle
- run: flutter --version
- name: Install dependencies
run: flutter pub get
- name: Perform Code Generation
run: flutter pub run build_runner build --delete-conflicting-outputs
- name: Decode Release Key
run: |
echo "$TUBESYNC_JKS" > myusync.b64
base64 --decode myusync.b64 > myusync.jks
env:
TUBESYNC_JKS: ${{ secrets.TUBESYNC_JKS }}
- name: Build Android Profile Apk
run: flutter build apk --profile
env:
TUBESYNC_KEY_PASSWORD: ${{ secrets.TUBESYNC_KEY_PASSWORD }}
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: myusync_android_nightly
path: build/app/outputs/flutter-apk/app-profile.apk
compression-level: 9
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version-file: pubspec.yaml
cache: true
- run: flutter --version
- name: Attach Commit ID to Version
run: |
# Retrieve the current commit hash
COMMIT_HASH=$(git rev-parse --short HEAD)
# Retrieve the current version from pubspec.yaml
CURRENT_VERSION=$(grep '^version:' pubspec.yaml | sed 's/version: //')
# Combine the version and commit hash
NEW_VERSION=$(echo $CURRENT_VERSION | sed "s/+/-$COMMIT_HASH+/")
# Update the version in pubspec.yaml
sed -i "s/^version: .*/version: $NEW_VERSION/" pubspec.yaml
# Validate
cat pubspec.yaml | grep '^version:'
- name: Install dependencies
run: |
sudo apt-get install -y clang cmake ninja-build pkg-config libmpv-dev libgtk-3-dev liblzma-dev libstdc++-12-dev
flutter pub get
- name: Perform Code Generation
run: flutter pub run build_runner build --delete-conflicting-outputs
- name: Build Linux Release
run: flutter build linux --release
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: myusync_linux_nightly
path: build/linux/x64/release/bundle/
compression-level: 9
build-ios:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
- name: Attach Commit ID to Version
run: |
# Retrieve the current commit hash
COMMIT_HASH=$(git rev-parse --short HEAD)
# Retrieve the current version from pubspec.yaml
CURRENT_VERSION=$(grep '^version:' pubspec.yaml | sed 's/version: //')
# Combine the version and commit hash
NEW_VERSION=$(echo $CURRENT_VERSION | sed "s/+/-$COMMIT_HASH+/")
# Update the version in pubspec.yaml
sed -i '' "s/^version: .*/version: $NEW_VERSION/" pubspec.yaml
# Validate
cat pubspec.yaml | grep '^version:'
- run: flutter --version
- name: Install dependencies
run: flutter pub get
- name: Perform Code Generation
run: flutter pub run build_runner build --delete-conflicting-outputs
- name: Build iOS Release
run: flutter build ios --release --no-codesign
- name: Prepare bundle
run: |
mkdir Payload
mv build/ios/iphoneos/Runner.app/ Payload
zip -qq -r -9 myusync_unsigned.ipa Payload
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: myusync_ios_nightly
path: myusync_unsigned.ipa
compression-level: 9
build-mac:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
- name: Attach Commit ID to Version
run: |
# Retrieve the current commit hash
COMMIT_HASH=$(git rev-parse --short HEAD)
# Retrieve the current version from pubspec.yaml
CURRENT_VERSION=$(grep '^version:' pubspec.yaml | sed 's/version: //')
# Combine the version and commit hash
NEW_VERSION=$(echo $CURRENT_VERSION | sed "s/+/-$COMMIT_HASH+/")
# Update the version in pubspec.yaml
sed -i '' "s/^version: .*/version: $NEW_VERSION/" pubspec.yaml
# Validate
cat pubspec.yaml | grep '^version:'
- run: flutter --version
- name: Install dependencies
run: flutter pub get
- name: Perform Code Generation
run: flutter pub run build_runner build --delete-conflicting-outputs
- name: Build MacOS Release
run: flutter build macos --release
- name: Prepare bundle
run: |
mv build/macos/Build/Products/Release/*.app ./
zip -r myusync_macos.zip *.app
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: myusync_macos_nightly
path: myusync_macos.zip
compression-level: 9