Skip to content

Windows & Android release #26

Windows & Android release

Windows & Android release #26

Workflow file for this run

name: Windows & Android release
on:
push:
branches:
- main
paths:
- "lib/**"
- "pubspec.yaml"
workflow_dispatch:
inputs:
android:
type: boolean
description: 'Билд для Android.'
required: false
default: true
windows:
type: boolean
description: 'Билд для Windows.'
required: false
default: true
telegram:
type: boolean
description: 'Указывает, будет ли создаваться публикация в Telegram-канале.'
required: false
default: true
debug:
type: boolean
description: 'Запуск данного Action с SSH-подключением в случае, если билд оказался неудачным (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
jobs:
build_android:
if: ${{ inputs.android }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Java and Flutter for Android
uses: actions/setup-java@v3
with:
distribution: "zulu"
java-version: "17"
cache: gradle
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
- name: Get dependencies
run: flutter pub get
- name: Sign Android release
run: |
echo '${{ secrets.ANDROID_KEYSTORE_FILE_BASE64 }}' | base64 --decode > android/app/upload-keystore.jks
echo '${{ secrets.ANDROID_KEY_PROPERTIES }}' > android/key.properties
- name: Build Android release
run: flutter build apk --release
- name: Publish in Telegram
if: ${{ inputs.telegram }}
run: curl -X POST https://api.telegram.org/bot${{ secrets.TELEGRAM_TOKEN }}/sendDocument -F chat_id="${{ secrets.TELEGRAM_TO }}" -F caption=' <b>🚧 Новый билд для Android</b>.' -F parse_mode='HTML' -F document=@'./build/app/outputs/flutter-apk/app-release.apk'
- name: Debug with SSH on fail
if: ${{ failure() && inputs.debug }}
uses: mxschmitt/action-tmate@v3
with:
limit-access-to-actor: true
build_windows:
if: ${{ inputs.windows }}
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
- name: Get dependencies
run: flutter pub get
- name: Build Windows release
run: flutter build windows --release
- name: Build installer and portable .7z archive
run: |
Write-Output "Creating portable 7z archive..."
& "C:\Program Files\7-Zip\7z.exe" a -t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on "./build/Flutter VK portable.7z" ./build/Windows/x64/runner/Release/
Write-Output "Downloading & installing iscc..."
curl -o build\iscc-installer.exe http://files.jrsoftware.org/is/6/innosetup-6.2.0.exe; & ".\build\iscc-installer.exe" /verysilent /allusers /dir=build\iscc
Write-Output "Creating installer"
& ".\build\iscc\iscc.exe" windows-setup-creator.iss
- name: Publish in Telegram
if: ${{ inputs.telegram }}
run: |
$telegramToken = $env:TELEGRAM_TOKEN
$telegramTo = $env:TELEGRAM_TO
# Installer
Invoke-RestMethod -Uri "https://api.telegram.org/bot$telegramToken/sendDocument" -Method Post -Form @{
chat_id = $telegramTo
caption = '<b>🚧 Новый билд для #Windows #installer</b>.'
parse_mode = 'HTML'
document = Get-Item -Path './build/Flutter VK installer.exe'
}
# Portable
Invoke-RestMethod -Uri "https://api.telegram.org/bot$telegramToken/sendDocument" -Method Post -Form @{
chat_id = $telegramTo
caption = '<b>🚧 Новый билд для #Windows #portable</b>.'
parse_mode = 'HTML'
document = Get-Item -Path './build/Flutter VK portable.7z'
}
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
TELEGRAM_TO: ${{ secrets.TELEGRAM_TO }}
- name: Debug with SSH on fail
if: ${{ failure() && inputs.debug }}
uses: mxschmitt/action-tmate@v3
with:
limit-access-to-actor: true