Skip to content

Release web and desktop apps #71

Release web and desktop apps

Release web and desktop apps #71

Workflow file for this run

name: Release web and desktop apps
on:
workflow_dispatch:
inputs:
release-type:
description: Release type
required: true
default: patch
type: choice
options:
- major
- minor
- patch
jobs:
build-desktop:
name: Build desktop apps
runs-on: ${{ matrix.os }}
if: ${{ github.ref == 'refs/heads/main' }}
strategy:
matrix:
type: [macos, windows, linux]
include:
- type: macos
os: macos-latest
build-path: build/macos/Build/Products/Release
build-output: appainter.app
- type: windows
os: windows-latest
build-path: build\windows\runner
build-output: Release
- type: linux
os: ubuntu-latest
build-path: build/linux/x64/release
build-output: bundle
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
- name: Get project Flutter version 🏷️
id: fvm-config
uses: kuhnroyal/flutter-fvm-config-action@v1.2.0
- name: Setup Flutter 💻
uses: subosito/flutter-action@v2.10.0
with:
flutter-version: ${{ steps.fvm-config.outputs.FLUTTER_VERSION }}
cache: true
cache-key: ${{ runner.os }}-flutter-${{ steps.fvm-config.outputs.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.lock') }}
- name: Cache Pub 💾
uses: actions/cache@v3
with:
path: |
${{ env.PUB_CACHE }}
**/.dart_tool
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-
- name: Patch for Linux build 🩹
if: ${{ matrix.type == 'linux' }}
run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build libgtk-3-dev
- name: Write Google service info file for MacOS 📝
if: ${{ matrix.type == 'macos' }}
run: printf "${{ secrets.GOOGLE_SERVICE_INFO_MACOS }}" > macos/Runner/GoogleService-Info.plist
- name: Build desktop app 🏗
run: |
flutter config --enable-${{ matrix.type }}-desktop
flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs
# Bump app version, the new version is committed in the release step
flutter pub run cider bump ${{ github.event.inputs.release-type }}
flutter build ${{ matrix.type }} --no-tree-shake-icons
- name: Compress app 🗜️
run: |
cd ${{ matrix.build-path }}
tar -zcvf appainter_${{ matrix.type }}.tar.gz ${{ matrix.build-output }}
- name: Upload app ⬆️
uses: actions/upload-artifact@v3
with:
path: "**/appainter_${{ matrix.type }}.tar.gz"
if-no-files-found: error
release-desktop:
name: Release desktop apps
runs-on: ubuntu-latest
needs: build-desktop
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.PAT }}
- name: Get project Flutter version 🏷️
id: fvm-config
uses: kuhnroyal/flutter-fvm-config-action@v1.2.0
- name: Setup Flutter 💻
uses: subosito/flutter-action@v2.10.0
with:
flutter-version: ${{ steps.fvm-config.outputs.FLUTTER_VERSION }}
cache: true
cache-key: ${{ runner.os }}-flutter-${{ steps.fvm-config.outputs.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.lock') }}
- name: Cache Pub 💾
uses: actions/cache@v3
with:
path: |
${{ env.PUB_CACHE }}
**/.dart_tool
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-
- name: Get previous tag 🏷️
id: previous-tag
uses: WyriHaximus/github-action-get-previous-tag@v1.3.0
- name: Bump app version 🔼
id: bump-version
run: |
flutter pub get
flutter pub run cider bump ${{ github.event.inputs.release-type }}
echo "version=v$(flutter pub run cider version)" >> $GITHUB_OUTPUT
- name: Commit new version 🆕
uses: stefanzweifel/git-auto-commit-action@v4.16.0
env:
version: ${{ steps.bump-version.outputs.version }}
with:
commit_message: "chore(release-desktop): ${{ env.version }} [skip ci]"
tagging_message: ${{ env.version }}
file_pattern: pubspec.yaml
push_options: --force
- name: Generate changelog 📝
id: generate-changelog
uses: mikepenz/release-changelog-builder-action@v3.7.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
configuration: changelog_config.json
fromTag: ${{ steps.previous-tag.outputs.tag }}
toTag: ${{ steps.bump-version.outputs.version }}
- name: Download artifacts ⬇️
uses: actions/download-artifact@v3
- name: Release 🚀
uses: ncipollo/release-action@v1.13.0
with:
tag: ${{ steps.bump-version.outputs.version }}
artifacts: "**/appainter*.tar.gz"
body: ${{ steps.generate-changelog.outputs.changelog }}
token: ${{ secrets.PAT }}
build-deploy-web:
name: Build web app and deploy
runs-on: ubuntu-latest
concurrency: deploy-web
needs: release-desktop
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: main
- name: Get project Flutter version 🏷️
id: fvm-config
uses: kuhnroyal/flutter-fvm-config-action@v1.2.0
- name: Setup Flutter 💻
uses: subosito/flutter-action@v2.10.0
with:
flutter-version: ${{ steps.fvm-config.outputs.FLUTTER_VERSION }}
cache: true
cache-key: ${{ runner.os }}-flutter-${{ steps.fvm-config.outputs.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.lock') }}
- name: Cache Pub 💾
uses: actions/cache@v3
with:
path: |
${{ env.PUB_CACHE }}
**/.dart_tool
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-
- name: Build web app 🏗
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
run: |
flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs
flutter build web --source-maps --no-tree-shake-icons --dart-define=FLUTTER_WEB_USE_SKIA=true
# Upload source map to Sentry
flutter packages pub run sentry_dart_plugin
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.4.3
with:
branch: gh-pages
folder: build/web
prepare-next-dev:
name: Prepare next development iteration
runs-on: ubuntu-latest
needs: build-deploy-web
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
with:
token: ${{ secrets.PAT }}
ref: main
fetch-depth: 0
- name: Get project Flutter version 🏷️
id: fvm-config
uses: kuhnroyal/flutter-fvm-config-action@v1.2.0
- name: Setup Flutter 💻
uses: subosito/flutter-action@v2.10.0
with:
flutter-version: ${{ steps.fvm-config.outputs.FLUTTER_VERSION }}
cache: true
cache-key: ${{ runner.os }}-flutter-${{ steps.fvm-config.outputs.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.lock') }}
- name: Cache Pub 💾
uses: actions/cache@v3
with:
path: |
${{ env.PUB_CACHE }}
**/.dart_tool
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-
- name: Bump app version 🔼
id: bump-version
run: |
flutter pub get
flutter pub run cider bump patch --pre=next
echo "version=v$(flutter pub run cider version)" >> $GITHUB_OUTPUT
- name: Commit new version 🆕
uses: stefanzweifel/git-auto-commit-action@v4.16.0
env:
version: ${{ steps.bump-version.outputs.version }}
with:
commit_message: "chore(release-next): ${{ env.version }} [skip ci]"
file_pattern: pubspec.yaml
push_options: --force