Merge pull request #275 from DattatreyaReddy/windows-fix #63
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish | |
on: | |
# Enable manual run | |
workflow_dispatch: | |
push: | |
tags: | |
- "*.*.*" | |
env: | |
pkg_name: tachidesk-sorayomi | |
jobs: | |
create-build: | |
name: Create ${{ matrix.target }} build | |
runs-on: ${{ matrix.os }} | |
# softprops/action-gh-release needs this permission | |
permissions: | |
contents: write | |
strategy: | |
# Disable fail-fast as we want results from all even if one fails. | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
target: android | |
build_path: build/app/outputs/flutter-apk | |
- os: macos-latest | |
target: ios | |
build_path: build/ios | |
- os: ubuntu-latest | |
target: web | |
build_path: build/web | |
- os: ubuntu-latest | |
target: linux | |
build_path: build/linux/x64/release/bundle | |
- os: macos-latest # Catalina | |
target: macos | |
build_path: build/macos/Build/Products/Release | |
- os: windows-latest | |
target: windows | |
build_path: build\windows\x64\runner\Release | |
steps: | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: 'stable' | |
- name: Install Linux dependencies | |
if: matrix.target == 'linux' | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y libgtk-3-dev libx11-dev pkg-config cmake ninja-build libblkid-dev | |
- name: Install Android dependencies | |
if: matrix.target == 'android' | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: "12.x" | |
- name: Enable desktop support | |
if: matrix.target != 'android' && matrix.target != 'ios' && matrix.target != 'web' | |
run: | | |
flutter config --enable-linux-desktop | |
flutter config --enable-macos-desktop | |
flutter config --enable-windows-desktop | |
- run: flutter doctor -v | |
- uses: actions/checkout@v3 | |
# - run: flutter create . | |
- run: flutter pub get | |
- name: Configure Keystore for Android | |
if: matrix.target == 'android' | |
working-directory: android | |
run: | | |
echo "${{ secrets.PLAY_STORE_UPLOAD_KEY }}" | base64 --decode > app/upload-keystore.jks | |
echo "storeFile=upload-keystore.jks" >> key.properties | |
echo "keyAlias=${{ secrets.KEYSTORE_KEY_ALIAS }}" >> key.properties | |
echo "storePassword=${{ secrets.KEYSTORE_STORE_PASSWORD }}" >> key.properties | |
echo "keyPassword=${{ secrets.KEYSTORE_KEY_PASSWORD }}" >> key.properties | |
- if: matrix.target != 'android' && matrix.target != 'ios' | |
run: flutter build ${{ matrix.target }} --release | |
- if: matrix.target == 'android' | |
run: | | |
flutter build apk --release | |
flutter build apk --split-per-abi --release | |
- if: matrix.target == 'ios' | |
run: flutter build ios --release --no-codesign | |
- name: Copy VC redistributables to release directory for Windows | |
if: matrix.target == 'windows' | |
working-directory: ${{ matrix.build_path }} | |
run: | | |
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x64\*\msvcp140.dll') . | |
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x64\*\vcruntime140.dll') . | |
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x64\*\vcruntime140_1.dll') . | |
- name: Rename build for Android | |
if: matrix.target == 'android' | |
working-directory: ${{ matrix.build_path }} | |
run: | | |
mv app-release.apk "$GITHUB_WORKSPACE/${{ env.pkg_name }}-${{ github.ref_name }}-${{ matrix.target }}-all.apk" | |
mv app-arm64-v8a-release.apk "$GITHUB_WORKSPACE/${{ env.pkg_name }}-${{ github.ref_name }}-${{ matrix.target }}-arm64-v8a.apk" | |
mv app-armeabi-v7a-release.apk "$GITHUB_WORKSPACE/${{ env.pkg_name }}-${{ github.ref_name }}-${{ matrix.target }}-armeabi-v7a.apk" | |
mv app-x86_64-release.apk "$GITHUB_WORKSPACE/${{ env.pkg_name }}-${{ github.ref_name }}-${{ matrix.target }}-x86_64.apk" | |
- name: Compress build for iOS | |
if: matrix.target == 'ios' | |
working-directory: ${{ matrix.build_path }} | |
run: | | |
cd iphoneos | |
mkdir Payload | |
cd Payload | |
ln -s ../Runner.app | |
cd .. | |
zip -r app-release.ipa Payload | |
mv app-release.ipa "$GITHUB_WORKSPACE/${{ env.pkg_name }}-${{ github.ref_name }}-${{ matrix.target }}.ipa" | |
- name: Compress build for Web | |
if: matrix.target == 'web' | |
working-directory: ${{ matrix.build_path }} | |
run: zip -r "$GITHUB_WORKSPACE/${{ env.pkg_name }}-${{ github.ref_name }}-${{ matrix.target }}.zip" * | |
- name: Compress build for Linux | |
if: matrix.target == 'linux' | |
working-directory: ${{ matrix.build_path }} | |
run: | | |
cp "$GITHUB_WORKSPACE/scripts/${{ env.pkg_name }}.desktop" . | |
cp "$GITHUB_WORKSPACE/assets/icons/launcher/sorayomi_icon.png" "./${{ env.pkg_name }}.png" | |
GZIP=-9 tar czf "$GITHUB_WORKSPACE/${{ env.pkg_name }}-${{ github.ref_name }}-${{ matrix.target }}-x64.tar.gz" * | |
- name: Build deb package | |
if: matrix.target == 'linux' | |
run: | | |
mkdir "build/deb" | |
mkdir "build/deb/${{ env.pkg_name }}-${{ github.ref_name }}" | |
cp -r "${{ matrix.build_path }}"/* "build/deb/${{ env.pkg_name }}-${{ github.ref_name }}/" | |
cp "${{ env.pkg_name }}-${{ github.ref_name }}-${{ matrix.target }}-x64.tar.gz" "build/deb/${{ env.pkg_name }}_${{ github.ref_name }}.orig.tar.gz" | |
cp -r scripts/debian "build/deb/${{ env.pkg_name }}-${{ github.ref_name }}/" | |
cd "build/deb/${{ env.pkg_name }}-${{ github.ref_name }}" | |
sed -i "s/\$pkgver/${{ github.ref_name }}/" debian/changelog | |
sed -i "s/\$pkgrel/1/" debian/changelog | |
sudo apt install build-essential devscripts debhelper | |
debuild --no-lintian -us -uc | |
cp "../${{ env.pkg_name }}_${{ github.ref_name }}-1_amd64.deb" "$GITHUB_WORKSPACE/" | |
- name: Compress build for macOS | |
if: matrix.target == 'macos' | |
working-directory: ${{ matrix.build_path }} | |
run: ditto -c -k --sequesterRsrc --keepParent "Tachidesk Sorayomi.app" "$GITHUB_WORKSPACE/${{ env.pkg_name }}-${{ github.ref_name }}-${{ matrix.target }}-x64.zip" | |
- name: Compress build for Windows | |
if: matrix.target == 'windows' | |
working-directory: ${{ matrix.build_path }} | |
run: compress-archive -Path * -DestinationPath "${env:GITHUB_WORKSPACE}\${{ env.pkg_name }}-${{ github.ref_name }}-${{ matrix.target }}-x64.zip" | |
- name: Create MSI Package | |
if: matrix.target == 'windows' && startsWith(github.ref, 'refs/tags/') | |
working-directory: ${{ matrix.build_path }} | |
run: | | |
$env:Path += ";C:\Program Files (x86)\WiX Toolset v3.11\bin" | |
$upgradeCode = [guid]::NewGuid().Guid | |
Copy-Item "${env:GITHUB_WORKSPACE}\scripts\${{ env.pkg_name }}-x64.wxs" . | |
Copy-Item "${env:GITHUB_WORKSPACE}\assets\icons\launcher\sorayomi_icon.ico" . | |
heat dir data -cg data -dr data -sreg -sfrag -gg -o data.wxs | |
candle -arch x64 -dVersion="${{ github.ref_name }}" -dUpgradeCode="$upgradeCode" -dIcon="sorayomi_icon.ico" "${{ env.pkg_name }}-x64.wxs" data.wxs | |
light -b data "${{ env.pkg_name }}-x64.wixobj" data.wixobj -o "${{ env.pkg_name }}-${{ github.ref_name }}-${{ matrix.target }}-x64.msi" | |
Move-Item "${{ env.pkg_name }}-${{ github.ref_name }}-${{ matrix.target }}-x64.msi" "${env:GITHUB_WORKSPACE}" | |
- name: Add packaged build to release draft | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
draft: false | |
files: ${{ env.pkg_name }}* | |
token: ${{ secrets.WINGET }} | |
winget-publish: | |
needs: create-build | |
runs-on: windows-latest # action can only be run on windows | |
steps: | |
- name: Update WINGET manifest | |
uses: vedantmgoyal2009/winget-releaser@v2 | |
with: | |
identifier: Suwayomi.Tachidesk-Sorayomi | |
version: ${{ github.ref_name }} | |
token: ${{ secrets.WINGET }} | |
homebrew-cask-publish: | |
needs: create-build | |
runs-on: macos-latest | |
steps: | |
- name: Update Homebrew cask | |
uses: macauley/action-homebrew-bump-cask@v1 | |
with: | |
token: ${{secrets.WINGET}} | |
tap: homebrew/homebrew-cask | |
cask: tachidesk-sorayomi | |
livecheck: true |