Skip to content

v0.2.3

v0.2.3 #11

Workflow file for this run

name: Flutter CI/CD
on:
push:
tags:
- 'v*'
release:
types: [published]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
actions: read
contents: write
env:
FLUTTER_VERSION: '3.40.0-0.2.pre'
FLUTTER_CHANNEL: 'beta'
JAVA_VERSION: '17'
jobs:
codegen:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: ${{ env.FLUTTER_CHANNEL }}
cache: true
- name: Get Flutter dependencies
run: flutter pub get
- name: Run Build Runner
run: dart run build_runner build --delete-conflicting-outputs
- name: Clean Environment
run: rm -rf .dart_tool .git build android/.gradle
- name: Upload Clean Source
uses: actions/upload-artifact@v4
with:
name: clean-source
path: .
retention-days: 1
android:
needs: codegen
runs-on: ubuntu-latest
steps:
- name: Download Source
uses: actions/download-artifact@v4
with:
name: clean-source
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ env.JAVA_VERSION }}
cache: 'gradle'
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: ${{ env.FLUTTER_CHANNEL }}
cache: true
- name: Cache Cargo Registry & Target
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
rust/target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Get dependencies
run: flutter pub get
- name: Build APK
run: flutter build apk --release --split-per-abi --target-platform android-arm64
- name: Upload APK artifacts
uses: actions/upload-artifact@v4
with:
name: android-apks
path: build/app/outputs/flutter-apk/*.apk
retention-days: 1
windows:
needs: codegen
runs-on: windows-latest
steps:
- name: Download Source
uses: actions/download-artifact@v4
with:
name: clean-source
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: ${{ env.FLUTTER_CHANNEL }}
cache: true
- name: Get dependencies
run: flutter pub get
- name: Build Windows EXE
run: flutter build windows --release
- name: Upload Windows artifacts
uses: actions/upload-artifact@v4
with:
name: windows-exe
path: build/windows/x64/runner/Release/*
retention-days: 1
ios:
needs: codegen
runs-on: macos-latest
steps:
- name: Download Source
uses: actions/download-artifact@v4
with:
name: clean-source
- name: Select Xcode version
run: sudo xcode-select -s /Applications/Xcode_16.4.app
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: ${{ env.FLUTTER_CHANNEL }}
cache: true
- name: Get dependencies
run: flutter pub get
- name: Build iOS app bundle
run: flutter build ios --release --no-codesign
- name: Create unsigned IPA
run: |
APP_BUNDLE="build/ios/iphoneos/Runner.app"
IPA_PATH="build/ios/iphoneos/Distribute.ipa"
mkdir -p Payload
cp -R "$APP_BUNDLE" Payload/
zip -r "$IPA_PATH" Payload
rm -rf Payload
echo "Created unsigned IPA at $IPA_PATH"
- name: Upload iOS IPA artifact
uses: actions/upload-artifact@v4
with:
name: ios-ipa
path: build/ios/iphoneos/*.ipa
retention-days: 1
macos:
needs: codegen
runs-on: macos-latest
steps:
- name: Download Source
uses: actions/download-artifact@v4
with:
name: clean-source
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: ${{ env.FLUTTER_CHANNEL }}
cache: true
- name: Get dependencies
run: flutter pub get
- name: Build macOS app
run: flutter build macos --release
- name: Create DMG
run: |
brew install create-dmg
mkdir -p dist
APP_PATH="build/macos/Build/Products/Release/Distribute.app"
APP_NAME="Distribute"
TEMP_DIR="temp_dmg_source"
DMG_NAME="dist/${APP_NAME}-${{ github.sha }}.dmg"
mkdir -p "$TEMP_DIR"
cp -R "$APP_PATH" "$TEMP_DIR/"
create-dmg \
--volname "${APP_NAME}-${{ github.sha }}" \
--volicon "$APP_PATH/Contents/Resources/AppIcon.icns" \
--window-pos 200 120 \
--window-size 800 400 \
--icon-size 100 \
--icon "$APP_NAME.app" 200 190 \
--hide-extension "$APP_NAME.app" \
--app-drop-link 600 185 \
"$DMG_NAME" \
"$TEMP_DIR"
rm -rf "$TEMP_DIR"
- name: Upload macOS DMG artifact
uses: actions/upload-artifact@v4
with:
name: macos-dmg
path: dist/*.dmg
retention-days: 1
linux:
needs: codegen
runs-on: ubuntu-latest
steps:
- name: Download Source
uses: actions/download-artifact@v4
with:
name: clean-source
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev libasound2-dev fuse libfuse2
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: ${{ env.FLUTTER_CHANNEL }}
cache: true
- name: Get dependencies
run: flutter pub get
- name: Build Linux app
run: flutter build linux --release
- name: Package AppImage
run: |
wget -N https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
wget -N https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-x86_64.AppImage
chmod +x linuxdeploy*.AppImage
cp assets/icon/icon-rounded-512.png distribute.png
./linuxdeploy-x86_64.AppImage \
--appdir AppDir \
--executable build/linux/x64/release/bundle/Distribute \
--desktop-file linux/net.sourceloc.distributeapp.desktop \
--icon-file distribute.png \
--output appimage
env:
APPIMAGE_EXTRACT_AND_RUN: 1
- name: Upload Linux artifact
uses: actions/upload-artifact@v4
with:
name: linux-app-image
path: Distribute*.AppImage
retention-days: 1
release:
needs: [android, windows, ios, macos, linux]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Rename and Prepare Assets
run: |
mkdir release_assets
VERSION="${{ github.ref_name }}"
if [ -d "artifacts/android-apks" ]; then
cd artifacts/android-apks
for apk in *.apk; do
suffix="${apk#app-}"
abi="${suffix%-release.apk}"
cp "$apk" "../../release_assets/android-${abi}-${VERSION}.apk"
done
cd ../..
fi
if [ -d "artifacts/windows-exe" ]; then
cd artifacts/windows-exe
zip -r "../../release_assets/windows-${VERSION}.zip" .
cd ../..
fi
if [ -d "artifacts/ios-ipa" ]; then
find artifacts/ios-ipa -name "*.ipa" -exec cp {} "release_assets/ios-${VERSION}.ipa" \;
fi
if [ -d "artifacts/macos-dmg" ]; then
find artifacts/macos-dmg -name "*.dmg" -exec cp {} "release_assets/macos-${VERSION}.dmg" \;
fi
if [ -d "artifacts/linux-app-image" ]; then
find artifacts/linux-app-image -name "*.AppImage" -exec cp {} "release_assets/" \;
fi
ls -l release_assets/
- name: Build Changelog
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v5
with:
configuration: ".github/changelog_config.json"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
uses: softprops/action-gh-release@v2
with:
body: ${{ steps.build_changelog.outputs.changelog }}
files: release_assets/*
generate_release_notes: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}