Draft Github Release #102
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: | |
workflow_dispatch: | |
# Enable manual run | |
push: | |
tags: | |
- "v*" | |
- "beta-v*" | |
jobs: | |
draft-release: | |
name: Draft Github release | |
runs-on: ubuntu-latest | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Get latest published release tag | |
id: get_latest_release | |
uses: pozetroninc/github-action-get-latest-release@master | |
with: | |
repository: ${{ github.repository }} | |
excludes: prerelease, draft | |
- name: Build changelog | |
id: github_release | |
uses: mikepenz/release-changelog-builder-action@v4 | |
with: | |
configuration: "changelog_configuration.json" | |
fromTag: ${{ steps.get_latest_release.outputs.release }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Draft release with changelog | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: KitchenOwl ${{ github.ref_name }} | |
body: ${{steps.github_release.outputs.changelog}} | |
draft: true | |
prerelease: ${{ startsWith(github.ref_name,'beta-v') }} | |
create-build: | |
name: Create ${{ matrix.target }} build | |
runs-on: ${{ matrix.os }} | |
container: ${{ matrix.container }} | |
strategy: | |
matrix: | |
target: [macOS, Windows, Linux, Android, Debian, Fedora, Web] | |
include: | |
- os: macos-latest | |
target: macOS | |
build_target: macos | |
build_path: kitchenowl/build/macos/Build/Products/Release | |
asset_extension: .zip | |
asset_content_type: application/zip | |
- os: windows-latest | |
target: Windows | |
build_target: windows | |
build_path: kitchenowl\build\windows\x64\runner\Release | |
asset_extension: .zip | |
asset_content_type: application/zip | |
- os: ubuntu-latest | |
target: Linux | |
build_target: linux | |
build_path: kitchenowl/build/linux/x64/release/bundle | |
asset_extension: .tar.gz | |
asset_content_type: application/gzip | |
- os: ubuntu-latest | |
target: Android | |
build_target: apk | |
build_path: kitchenowl/build/app/outputs/flutter-apk | |
asset_extension: .apk | |
asset_content_type: application/vnd.android.package-archive | |
- os: ubuntu-latest | |
target: Debian | |
build_target: linux | |
build_path: kitchenowl/build/debian/release | |
asset_extension: .deb | |
asset_content_type: application/vnd.debian.binary-package | |
- os: ubuntu-latest | |
container: | |
image: fedora:latest | |
options: --group-add 135 | |
target: Fedora | |
build_target: linux | |
build_path: kitchenowl/build/fedora/release | |
asset_extension: .rpm | |
asset_content_type: application/x-rpm | |
- os: ubuntu-latest | |
target: Web | |
build_target: web --dart-define=FLUTTER_WEB_CANVASKIT_URL=/canvaskit/ | |
build_path: kitchenowl/build/web | |
asset_extension: .tar.gz | |
asset_content_type: application/gzip | |
# Disable fail-fast as we want results from all even if one fails. | |
fail-fast: false | |
needs: draft-release | |
steps: | |
- name: Install Linux dependencies | |
if: matrix.target == 'Linux' || matrix.target == 'Debian' || matrix.target == 'Web' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libgtk-3-dev libx11-dev pkg-config cmake ninja-build libblkid-dev libsecret-1-dev | |
- name: Install Fedora dependencies | |
if: matrix.target == 'Fedora' | |
run: | | |
sudo dnf update -y | |
sudo dnf install -y gcc gcc-c++ clang gtk3-devel libX11-devel pkg-config cmake ninja-build libblkid-devel libsecret-devel fedora-packager fedora-review shyaml which | |
- name: Install Android dependencies | |
if: matrix.target == 'Android' | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- name: Install Debian dependencies | |
if: matrix.target == 'Debian' | |
run: | | |
sudo apt-get install -y python3 | |
pip3 install shyaml | |
# Set up Flutter. | |
- name: Clone Flutter repository with stable channel | |
if: matrix.target != 'Fedora' | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: stable | |
- name: Clone Flutter repository with stable channel Fedora | |
if: matrix.target == 'Fedora' | |
run: | | |
git clone https://github.com/flutter/flutter.git -b stable | |
echo "/usr/local/src/flutter/bin" >> $GITHUB_PATH | |
export PATH="$PATH:/usr/local/src/flutter/bin" | |
working-directory: /usr/local/src | |
- name: Enable desktop support | |
if: matrix.target != 'Android' | |
run: | | |
flutter config --enable-linux-desktop | |
flutter config --enable-macos-desktop | |
flutter config --enable-windows-desktop | |
- run: flutter config --no-analytics | |
- run: flutter doctor -v | |
# Checkout code get packages. | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- run: flutter packages get | |
working-directory: kitchenowl | |
- name: Configure Keystore for Android | |
if: matrix.target == 'Android' | |
run: | | |
echo "$PLAY_STORE_UPLOAD_KEY" | base64 --decode > app/upload-keystore.jks | |
echo "storeFile=upload-keystore.jks" >> key.properties | |
echo "keyAlias=$KEYSTORE_KEY_ALIAS" >> key.properties | |
echo "storePassword=$KEYSTORE_STORE_PASSWORD" >> key.properties | |
echo "keyPassword=$KEYSTORE_KEY_PASSWORD" >> key.properties | |
env: | |
PLAY_STORE_UPLOAD_KEY: ${{ secrets.PLAY_STORE_UPLOAD_KEY }} | |
KEYSTORE_KEY_ALIAS: ${{ secrets.KEYSTORE_KEY_ALIAS }} | |
KEYSTORE_KEY_PASSWORD: ${{ secrets.KEYSTORE_KEY_PASSWORD }} | |
KEYSTORE_STORE_PASSWORD: ${{ secrets.KEYSTORE_STORE_PASSWORD }} | |
working-directory: kitchenowl/android | |
# Build the application. | |
- run: flutter build -v ${{ matrix.build_target }} --release | |
working-directory: kitchenowl | |
# 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: kitchenowl | |
- name: Rename build for Android | |
if: matrix.target == 'Android' | |
run: mv app-release.apk $GITHUB_WORKSPACE/kitchenowl_${{ matrix.target }}.apk | |
working-directory: ${{ matrix.build_path }} | |
- name: Compress build for Linux and Web | |
if: matrix.target == 'Linux' || matrix.target == 'Web' | |
run: tar czf $GITHUB_WORKSPACE/kitchenowl_${{ matrix.target }}.tar.gz * | |
working-directory: ${{ matrix.build_path }} | |
- name: Compress build for macOS | |
if: matrix.target == 'macOS' | |
run: ditto -c -k --sequesterRsrc --keepParent kitchenowl.app $GITHUB_WORKSPACE/kitchenowl_${{ matrix.target }}.zip | |
working-directory: ${{ matrix.build_path }} | |
- name: Compress build for Windows | |
if: matrix.target == 'Windows' | |
run: compress-archive -Path * -DestinationPath ${env:GITHUB_WORKSPACE}\kitchenowl_${{ matrix.target }}.zip | |
working-directory: ${{ matrix.build_path }} | |
- name: Package build for debian | |
if: matrix.target == 'Debian' | |
run: ./build.sh | |
working-directory: kitchenowl/debian | |
- name: Rename build for debian | |
if: matrix.target == 'Debian' | |
run: mv kitchenowl.deb $GITHUB_WORKSPACE/kitchenowl_${{ matrix.target }}.deb | |
working-directory: ${{ matrix.build_path }} | |
- name: Package build for Fedora | |
if: matrix.target == 'Fedora' | |
run: ./build.sh | |
working-directory: kitchenowl/fedora | |
- name: Rename build for fedora | |
if: matrix.target == 'Fedora' | |
run: mv KitchenOwl.x86_64.rpm $GITHUB_WORKSPACE/kitchenowl_${{ matrix.target }}.rpm | |
working-directory: ${{ matrix.build_path }} | |
# Upload the build. | |
- name: Add packaged build to release draft | |
id: upload_release_asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.draft-release.outputs.upload_url }} | |
asset_path: ./kitchenowl_${{ matrix.target }}${{ matrix.asset_extension }} | |
asset_name: kitchenowl_${{ matrix.target }}${{ matrix.asset_extension }} | |
asset_content_type: ${{ matrix.asset_content_type }} |