Release All Platforms #18
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: Release All Platforms | |
on: | |
workflow_dispatch: | |
# inputs: | |
# tag: | |
# description: 'Enter a tag for this release' | |
# required: true | |
# type: string | |
# Release_note: | |
# description: 'Enter your release notes' | |
# required: true | |
# type: string | |
jobs: | |
version: | |
runs-on: windows-latest | |
permissions: | |
contents: read | |
outputs: | |
version: ${{ steps.extract_version.outputs.version }} | |
steps: | |
- uses: actions/[email protected] | |
- name: Extract Version from pubspec.yaml | |
id: extract_version | |
run: | | |
$VERSION = Select-String -Path ".\pubspec.yaml" -Pattern "^\s*version:\s*(\d+\.\d+\.\d+)" -CaseSensitive | ForEach-Object{ $_.Matches.Groups[1].Value } | |
echo version=$VERSION >> $env:GITHUB_OUTPUT | |
Build-windows: | |
runs-on: windows-latest | |
permissions: | |
contents: read | |
needs: version | |
steps: | |
- uses: actions/[email protected] | |
- name: Replace iss placeholders | |
run: | | |
$outputDir = "${{ github.workspace }}" | |
$setupIconFile = "${{ github.workspace }}\assets\icons\logo.ico" | |
$baseDir = "${{ github.workspace }}" | |
$briskVersion = "${{ needs.version.outputs.version }}" | |
$outputBaseFileName = "Brisk-v${{ needs.version.outputs.version }}-windows-x86_64" | |
(Get-Content windows/packaging/exe/inno.iss) -replace 'OUTPUT_DIR', $outputDir | Set-Content windows/packaging/exe/inno.iss | |
(Get-Content windows/packaging/exe/inno.iss) -replace 'BRISK_VERSION', $briskVersion | Set-Content windows/packaging/exe/inno.iss | |
(Get-Content windows/packaging/exe/inno.iss) -replace 'SETUP_ICON_FILE', $setupIconFile | Set-Content windows/packaging/exe/inno.iss | |
(Get-Content windows/packaging/exe/inno.iss) -replace 'BASE_DIR', $baseDir | Set-Content windows/packaging/exe/inno.iss | |
(Get-Content windows/packaging/exe/inno.iss) -replace 'EXE_NAME', $exeName | Set-Content windows/packaging/exe/inno.iss | |
(Get-Content windows/packaging/exe/inno.iss) -replace 'OUTPUT_BASE_FILE_NAME', $outputBaseFileName | Set-Content windows/packaging/exe/inno.iss | |
- name: Display Inno Setup File Content | |
shell: pwsh | |
run: | | |
Get-Content "windows/packaging/exe/inno.iss" | ForEach-Object { Write-Output $_ } | |
Write-Output "End of inno.iss content." | |
- name: Install flutter | |
uses: subosito/[email protected] | |
with: | |
flutter-version: "3.22.0" | |
channel: 'stable' | |
cache: true | |
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' | |
cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:' | |
architecture: x64 | |
- name: Install project dependencies | |
run: | | |
flutter pub get | |
dart pub global activate flutter_distributor | |
choco install innosetup --yes | |
echo "Inno Setup installed." | |
- name: Generate intermediates | |
run: flutter pub run build_runner build --delete-conflicting-outputs | |
- name: Set proper icon path | |
run: | | |
$iconPath = "${{ github.workspace }}\\assets\\icons\\logo.ico" | |
(Get-Content windows/packaging/exe/make_config.yaml) -replace 'PLACEHOLDER_ICON_PATH', $iconPath | Set-Content windows/packaging/exe/make_config.yaml | |
- name: Enable windows build | |
run: flutter config --enable-windows-desktop | |
- name: Build Brisk | |
run: flutter build windows | |
- name: Build Brisk Auto Updater | |
run: flutter build windows --release | |
working-directory: brisk_auto_updater | |
- name: Zip the build output | |
run: | | |
$mainAppPath = "${{ github.workspace }}\build\windows\x64\runner\Release" | |
$updaterPath = "${{ github.workspace }}\brisk_auto_updater\build\windows\x64\runner\Release" | |
$zipFileName = "${{ github.workspace }}\Brisk-v${{ needs.version.outputs.version }}-windows-x86_64.zip" | |
$updaterAppPath = "$mainAppPath\updater" | |
mkdir $updaterAppPath | |
# Copy updater application including the data folder | |
Copy-Item -Path "$updaterPath\*" -Destination "$updaterAppPath" -Recurse | |
# Copy data folder as a whole to avoid merging its contents | |
# $dataFolderPath = "${{ github.workspace }}\brisk_auto_updater\build\windows\x64\runner\Release\data" | |
# Copy-Item -Path $dataFolderPath -Destination "$updaterDest" -Recurse | |
# Create the zip archive | |
Compress-Archive -Path "$mainAppPath\*" -DestinationPath "$zipFileName" -Force | |
- name: Create Installer with Inno Setup | |
run: | | |
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" "${{ github.workspace }}\windows\packaging\exe\inno.iss" | |
- name: Raname exe file | |
run: Rename-Item -Path "${{ github.workspace }}\Brisk.exe" -NewName "Brisk-v${{ needs.version.outputs.version }}-windows-x86_64.exe" | |
- name: Upload artifact | |
uses: actions/[email protected] | |
with: | |
name: brisk-windows-exe | |
path: Brisk-v${{ needs.version.outputs.version }}-windows-x86_64.exe | |
retention-days: 1 | |
- name: Upload artifact | |
uses: actions/[email protected] | |
with: | |
name: brisk-windows-zip | |
path: Brisk-v${{ needs.version.outputs.version }}-windows-x86_64.zip | |
retention-days: 1 | |
Build-Linux: | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: read | |
needs: version | |
steps: | |
- name: Checkout the code | |
uses: actions/[email protected] | |
- name: Install flutter | |
uses: subosito/[email protected] | |
with: | |
flutter-version: "3.22.0" | |
channel: 'stable' | |
cache: true | |
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' | |
cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:' | |
architecture: x64 | |
- name: Install required tools | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y keybinder-3.0 clang cmake git ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev rpm patchelf libayatana-appindicator3-dev | |
- name: Enable linux-desktop for flutter | |
run: flutter config --enable-linux-desktop && export PATH="$PATH":"$HOME/.pub-cache/bin" | |
- name: Get dependencies | |
run: flutter pub get | |
- name: Start the build process | |
run: flutter build linux --release | |
- name: Build Brisk Auto Updater | |
run: flutter build linux --release | |
working-directory: brisk_auto_updater | |
- name: Copy Auto Updater to Bundle | |
run: | | |
mkdir ${{ github.workspace }}/build/linux/x64/release/bundle/updater | |
cp -R ${{ github.workspace }}/brisk_auto_updater/build/linux/x64/release/bundle/* ${{ github.workspace }}/build/linux/x64/release/bundle/updater | |
- name: Compress the release file | |
run: tar -cJf Brisk-v${{ needs.version.outputs.version }}-linux-x86_64.tar.xz -C build/linux/x64/release/bundle/ . | |
- name: Upload artifact | |
uses: actions/[email protected] | |
with: | |
name: brisk-package | |
path: ./Brisk-v${{ needs.version.outputs.version }}-linux-x86_64.* | |
retention-days: 1 | |
# Build-macos: | |
# runs-on: macos-latest | |
# permissions: | |
# contents: read | |
# needs: version | |
# steps: | |
# | |
# - name: Checkout the code | |
# uses: actions/[email protected] | |
# | |
# - name: Set up Node.js | |
# uses: actions/setup-node@v3 | |
# with: | |
# node-version: '20' | |
# | |
# - name: Install npm dependencies | |
# run: npm install -g appdmg | |
# | |
# - name: Install flutter | |
# uses: subosito/[email protected] | |
# with: | |
# flutter-version: "3.22.0" | |
# channel: 'stable' | |
# cache: true | |
# cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' | |
# cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:' | |
# | |
# - name: Enable linux-desktop for flutter | |
# run: flutter config --enable-macos-desktop && export PATH="$PATH":"$HOME/.pub-cache/bin" | |
# | |
# - name: Copy MacOS related files | |
# run: | | |
# cp macos/Runner/Release.entitlements . | |
# cp -r macos/Runner/Assets.xcassets . | |
# cp -r macos/packaging . | |
# | |
# - name: Recreate MacOS directory | |
# run: | | |
# rm -rf macos | |
# flutter create --platform macos . | |
# | |
# - name: Replace MacOS files | |
# run: | | |
# mv packaging macos/ | |
# cp -f Release.entitlements macos/Runner/ | |
# cp -rf Assets.xcassets macos/Runner/ | |
# | |
# - name: Get dependencies | |
# run: flutter pub get | |
# | |
# - name: Install flutter_distributor | |
# run: dart pub global activate flutter_distributor | |
# | |
# - name: Start the build process | |
# run: flutter_distributor package --platform macos --targets dmg | |
# | |
# - name: Debug | |
# run: ls dist/${{ needs.version.outputs.version }} | |
# | |
# - name: Rename dmg File | |
# run: mv dist/${{ needs.version.outputs.version }}/brisk-${{ needs.version.outputs.version }}+${{ needs.version.outputs.version }}-macos.dmg ./Brisk-${{ needs.version.outputs.version }}-macos-x64.dmg | |
# | |
# - name: Upload artifact | |
# uses: actions/[email protected] | |
# with: | |
# name: brisk-dmg | |
# path: Brisk-${{ needs.version.outputs.version }}-macos-x64.dmg | |
# retention-days: 1 | |
Release: | |
runs-on: ubuntu-22.04 | |
# needs: [Build-Linux, Build-windows, Build-macos, version] | |
needs: [Build-Linux, Build-windows, version] | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout the code | |
uses: actions/[email protected] | |
- name: Download linux artifact | |
uses: actions/[email protected] | |
with: | |
name: brisk-package | |
- name: Download artifact package | |
uses: actions/[email protected] | |
with: | |
name: brisk-windows-exe | |
- name: Download artifact package | |
uses: actions/[email protected] | |
with: | |
name: brisk-windows-zip | |
- name: Release the changes | |
uses: softprops/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ needs.version.outputs.version }} | |
body_path: ./.github/release.md | |
files: | | |
./Brisk-v${{ needs.version.outputs.version }}-linux-x86_64.tar.xz | |
./Brisk-v${{ needs.version.outputs.version }}-windows-x86_64.zip | |
./Brisk-v${{ needs.version.outputs.version }}-windows-x86_64.exe |