version bump #8
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: yliw | |
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 | |
# - os: windows-latest | |
# target: windows-arm64 | |
# build_path: build\windows\arm64\runner\Release | |
steps: | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: "stable" | |
# Install Linux dependencies | |
- 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 | |
# Install Android dependencies | |
- name: Install Android dependencies | |
if: matrix.target == 'android' | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "zulu" | |
java-version: "17" | |
# Enable desktop support | |
- 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 | |
# Recreating the project | |
- run: flutter doctor -v | |
- uses: actions/checkout@v4 | |
# - run: flutter create . | |
- run: flutter pub get | |
# Configure Keystore for Android | |
- 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 | |
# Build the project for the target platform | |
- 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 | |
# Windows packaging | |
- 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') . | |
# Windows packaging | |
# - name: Copy VC redistributables to release directory for Windows | |
# if: matrix.target == 'windows-arm64' | |
# working-directory: ${{ matrix.build_path }} | |
# run: | | |
# Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\arm64\*\msvcp140.dll') . | |
# Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\arm64\*\vcruntime140.dll') . | |
# Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\arm64\*\vcruntime140_1.dll') . | |
# Android packaging | |
- 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/images/yliw.png" "./${{ env.pkg_name }}.png" | |
GZIP=-9 tar czf "$GITHUB_WORKSPACE/${{ env.pkg_name }}-${{ github.ref_name }}-${{ matrix.target }}-x64.tar.gz" * | |
# Debian packaging | |
- 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/" | |
# macOS packaging | |
- name: Compress build for macOS | |
if: matrix.target == 'macos' | |
working-directory: ${{ matrix.build_path }} | |
run: ditto -c -k --sequesterRsrc --keepParent "Yliw.app" "$GITHUB_WORKSPACE/${{ env.pkg_name }}-${{ github.ref_name }}-${{ matrix.target }}-x64.zip" | |
# Windows packaging | |
- 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" | |
# Windows packaging | |
- 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 }}-arm64.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\images\yliw.ico" . | |
heat dir data -cg data -dr data -sreg -sfrag -gg -o data.wxs | |
candle -arch x64 -dVersion="${{ github.ref_name }}" -dUpgradeCode="$upgradeCode" -dIcon="yliw.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: Create arm64 MSI Package | |
# if: matrix.target == 'windows-arm64' && 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 }}-arm64.wxs" . | |
# Copy-Item "${env:GITHUB_WORKSPACE}\assets\images\yliw.ico" . | |
# heat dir data -cg data -dr data -sreg -sfrag -gg -o data.wxs | |
# candle -arch arm64 -dVersion="${{ github.ref_name }}" -dUpgradeCode="$upgradeCode" -dIcon="yliw.ico" "${{ env.pkg_name }}-arm64.wxs" data.wxs | |
# light -b data "${{ env.pkg_name }}-arm64.wixobj" data.wixobj -o "${{ env.pkg_name }}-${{ github.ref_name }}-${{ matrix.target }}-arm64.msi" | |
# Move-Item "${{ env.pkg_name }}-${{ github.ref_name }}-${{ matrix.target }}-arm64.msi" "${env:GITHUB_WORKSPACE}" | |
- name: Add packaged build to release draft | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
draft: false | |
files: ${{ env.pkg_name }}* | |
token: ${{ secrets.YLIW_RELEASE_KEY }} | |
# 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: padya.yliw | |
# version: ${{ github.ref_name }} | |
# token: ${{ secrets.YLIW_RELEASE_KEY }} | |
# 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.YLIW_RELEASE_KEY}} | |
# tap: homebrew/homebrew-cask | |
# cask: yliw | |
# livecheck: true |