Skip to content

Commit

Permalink
Update release.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
MCDFsteve authored Sep 14, 2024
1 parent 78f0180 commit aa5ecf6
Showing 1 changed file with 33 additions and 21 deletions.
54 changes: 33 additions & 21 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,50 +54,57 @@ jobs:
# Checkout branch
- name: Checkout
uses: actions/checkout@v3
# Add Android keystore

# Setup Android keystore (for Android)
- name: Setup Android keystore
if: matrix.target == 'Android'
run: |
echo "${{ secrets.ENCODED_KEYSTORE }}" | base64 -di > android/app/upload-keystore.jks
echo "${{ secrets.KEY_PROPERTIES }}" > android/key.properties
# Setup Flutter
- name: Setup Flutter
uses: subosito/[email protected]
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: 'stable'
cache: true
# Cache Pod

# Cache CocoaPods (for iOS/macOS)
- name: Cache Pod
if: matrix.cache_pod_key != null
uses: actions/cache@v3
with:
key: ${{ matrix.cache_pod_key }}
path: ${{ matrix.cache_pod_path }}
restore-keys: ${{ matrix.cache_key }}-${{ hashFiles(matrix.cache_pod_restore_keys_hash_file)}}
# Setup JDK
restore-keys: ${{ matrix.cache_pod_key }}-${{ hashFiles(matrix.cache_pod_restore_keys_hash_file) }}

# Setup JDK for Android
- name: Setup JDK 17 (Android)
if: matrix.target == 'Android'
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
cache: gradle
# Xcodebuild
- name: Build Xcode

# Xcode build for iOS/macOS
- name: Build Xcode (iOS/macOS)
if: matrix.os == 'macos-latest'
run: xcodebuild -resolvePackageDependencies -workspace ios/Runner.xcworkspace -scheme Runner -configuration Release

# Flutter Pub Get
- name: Flutter Pub Get
run: |
git config --global core.longpaths true
flutter pub get
# Get app version
- name: Get app version
id: get_version
shell: bash
run: |
echo "::set-output name=version::$(head -n 19 pubspec.yaml | tail -n 1 | cut -d ' ' -f 2)"
echo "::set-output name=version::$(grep '^version:' pubspec.yaml | cut -d ' ' -f 2)"
# Build Android .apk
- name: Build Android
if: matrix.target == 'Android'
Expand All @@ -107,9 +114,10 @@ jobs:
mv app-arm64-v8a-release.apk FnipaPlay-${{ steps.get_version.outputs.version }}-arm64-v8a.apk
mv app-armeabi-v7a-release.apk FnipaPlay-${{ steps.get_version.outputs.version }}-armeabi-v7a.apk
mv app-x86_64-release.apk FnipaPlay-${{ steps.get_version.outputs.version }}-x86_64.apk
# Build iOS .ipa
- name: Build iOS
if: matrix.target == 'ios'
if: matrix.target == 'iOS'
run: |
cd ios
pod update
Expand All @@ -120,6 +128,7 @@ jobs:
mkdir -p Payload
mv ios/iphoneos/*.app Payload
zip -9 FnipaPlay_${{ steps.get_version.outputs.version }}.ipa -r Payload
# Build macOS .dmg
- name: Build macOS
if: matrix.target == 'macOS'
Expand All @@ -128,6 +137,7 @@ jobs:
pod update
cd ..
sh dmg.sh
# Build Windows .zip
- name: Build Windows
if: matrix.target == 'Windows'
Expand All @@ -139,19 +149,20 @@ jobs:
Copy-Item $SrcDir\* -Recurse $DestDir
Copy-Item -Filter *.dll -Path windows\* -Destination $DestDir -Force
Compress-Archive $DestDir build\windows\FnipaPlay_${{ steps.get_version.outputs.version }}_Windows.zip
# Build Linux .deb
- name: Build Linux
if: matrix.target == 'Linux'
run: |
# Prepare build depends
# Install mpv and dependencies
sudo apt-get update -y
sudo apt-get install -y clang cmake libgtk-3-dev ninja-build libasound2-dev libass-dev
sudo apt-get install -y mpv libmpv-dev pkg-config clang cmake libgtk-3-dev ninja-build libasound2-dev libass-dev
# Compile
# Build Flutter for Linux
flutter config --enable-linux-desktop
flutter build linux --release
# Debian package
# Create Debian package
mkdir -p build/linux/FnipaPlay-${{ steps.get_version.outputs.version }}-Linux-amd64
cd build/linux/FnipaPlay-${{ steps.get_version.outputs.version }}-Linux-amd64
mkdir -p opt/fnipaplay
Expand All @@ -161,8 +172,7 @@ jobs:
cp -r ../../../assets/linux/DEBIAN .
chmod 0755 DEBIAN/postinst
chmod 0755 DEBIAN/postrm
cat>DEBIAN/control<<EOF
cat > DEBIAN/control <<EOF
Maintainer: madoka773 <[email protected]>
Package: Fnipaplay
Version: ${{ steps.get_version.outputs.version }}
Expand All @@ -173,22 +183,20 @@ jobs:
Installed-Size: 34648
Description: A cross platform danmaku video player.
Homepage: https://github.com/MCDFsteve/FnipaPlay
Depends: ffmpeg,
libass9
Depends: ffmpeg, libass9
EOF
cp ../../../assets/linux/io.github.MCDFsteve.FnipaPlay.desktop usr/share/applications
cp ../../../assets/images/logo512.png usr/share/icons/hicolor/512x512/apps/io.github.MCDFsteve.FnipaPlay.png
cd ..
dpkg-deb --build --root-owner-group FnipaPlay-${{ steps.get_version.outputs.version }}-Linux-amd64
# Upload Artifacts
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.artifact_path }}

Publish:
if: startsWith(github.ref, 'refs/tags/')
name: Publish
Expand All @@ -197,14 +205,18 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Make tmp dir
run: mkdir /tmp/artifacts

- name: Download all Artifacts
uses: actions/download-artifact@v3
with:
path: /tmp/artifacts

- name: List all Artifacts
run: ls -R /tmp/artifacts

- name: Upload to release
uses: ncipollo/release-action@v1
with:
Expand Down

0 comments on commit aa5ecf6

Please sign in to comment.