Used dmg for macos build (#6) #50
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: Draft Github Release | |
on: | |
push: | |
branches: | |
- master | |
# Enable manual run | |
# workflow_dispatch: | |
# inputs: | |
# version: | |
# description: "Tag to create (e.g. v2.10.0). Must include 'v' and must match pubspec" | |
# required: true | |
# default: "v2.10.0" | |
# type: string | |
# Declare default permissions as read only. | |
permissions: read-all | |
jobs: | |
draft-release: | |
name: Draft Github release | |
runs-on: ubuntu-latest | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- name: Setup Dart Language | |
uses: dart-lang/[email protected] | |
- name: Get Project Version | |
run: "dart workflows_utils/get_project_version.dart" | |
- name: Draft release with release notes | |
id: create_release | |
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
with: | |
tag_name: ${{ env.version_name }} | |
draft: true | |
prerelease: false | |
generate_release_notes: true | |
create-build: | |
name: Create ${{ matrix.target }} build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
target: [macOS, Windows, Linux] | |
include: | |
- os: macos-latest | |
target: macOS | |
build_target: macos | |
build_path: build/macos/Build/Products/Release | |
asset_extension: .dmg | |
asset_content_type: application/vnd.appimage | |
- os: windows-latest | |
target: Windows | |
build_target: windows | |
build_path: build/windows/x64/runner/Release | |
asset_extension: .zip | |
asset_content_type: application/zip | |
- os: ubuntu-latest | |
target: Linux | |
build_target: linux | |
build_path: build/linux/x64/release/bundle | |
asset_extension: .tar.gz | |
asset_content_type: application/gzip | |
- os: ubuntu-latest | |
# target: Android | |
# build_target: apk | |
# build_path: build/app/outputs/flutter-apk | |
# asset_extension: .apk | |
# asset_content_type: application/vnd.android.package-archive | |
# Disable fail-fast as we want results from all even if one fails. | |
fail-fast: false | |
needs: draft-release | |
steps: | |
# Set up Flutter. | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
- name: Install Linux dependencies | |
if: matrix.target == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libgtk-3-dev libx11-dev pkg-config cmake ninja-build libblkid-dev | |
- run: flutter doctor -v | |
# Checkout EyesCare code, recreate missing files, and get packages. | |
- name: Checkout EyesCare code | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- run: flutter create . | |
- run: flutter pub get | |
- name: install linux requirements for local_notifier package | |
if: matrix.target == 'Linux' | |
run: sudo apt-get install libnotify-dev | |
# Build the application. | |
- run: flutter build -v ${{ matrix.build_target }} --release | |
# Package the build. | |
- name: Copy VC redistributables to release directory for Windows | |
if: matrix.target == 'Windows' | |
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') . | |
working-directory: ${{ matrix.build_path }} | |
- name: Compress build for Linux | |
if: matrix.target == 'Linux' | |
run: tar czf $GITHUB_WORKSPACE/EyesCare${{ matrix.target }}.tar.gz * | |
working-directory: ${{ matrix.build_path }} | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- name: Convert build to dmg for macOS | |
if: matrix.target == 'macOS' | |
run: | | |
brew install [email protected] | |
npm config set python /usr/local/bin/python3.9 | |
npm install -g appdmg | |
- name: run appdmg | |
if: matrix.target == 'macOS' | |
run: appdmg installer/dmg_creator/config.json $GITHUB_WORKSPACE/EyesCare${{ matrix.target }}.dmg | |
- name: Compress build for Windows | |
if: matrix.target == 'Windows' | |
run: compress-archive -Path * -DestinationPath ${env:GITHUB_WORKSPACE}\EyesCare${{ matrix.target }}.zip | |
working-directory: ${{ matrix.build_path }} | |
# Upload the build. | |
- name: Add packaged build to release draft | |
id: upload_release_asset | |
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
with: | |
upload_url: ${{ needs.draft-release.outputs.upload_url }} | |
asset_path: ./EyesCare${{ matrix.target }}${{ matrix.asset_extension }} | |
asset_name: EyesCare${{ matrix.target }}${{ matrix.asset_extension }} | |
asset_content_type: ${{ matrix.asset_content_type }} |