Skip to content

Test automatic releases to dev tag #10

Test automatic releases to dev tag

Test automatic releases to dev tag #10

Workflow file for this run

name: GarageScouter
on:
push:
branches: [main]
pull_request:
env:
FLUTTER_VERSION: 3.16.9
jobs:
formatting-analysis:
name: "Check Formatting & Analysis"
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
cache-path: ${{ runner.tool_cache }}/flutter/linux
- name: Get dependencies
run: flutter pub get
- name: Generate mocks
run: dart run build_runner build
- name: Analyze
run: flutter analyze
- name: Check formatting
run: dart format -o none --set-exit-if-changed lib/* test/*
test:
name: "Run Tests"
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
cache-path: ${{ runner.tool_cache }}/flutter/linux
- name: Get dependencies
run: flutter pub get
# - name: Generate full coverage test
# run: dart run full_coverage
# - name: Generate mocks
# run: dart run build_runner build
# - name: Run tests
# run: flutter test --coverage
# - name: Upload coverage reports to Codecov
# uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# name: flutter-coverage
# files: coverage/lcov.info
build:
strategy:
fail-fast: false
matrix:
include:
- os: windows-2022
build-option: "windows"
build-path: "build/windows/x64/runner/Release"
artifact-path: "GarageScouter-Windows.zip"
artifact-name: GarageScouter-Windows
- os: macos-14
build-option: "macos"
build-path: "build/macos/Build/Products/Release/GarageScouter-macOS.zip"
artifact-path: "build/macos/Build/Products/Release/GarageScouter-macOS.zip"
artifact-name: GarageScouter-macOS
- os: ubuntu-22.04
build-option: "linux"
build-path: "build/linux/x64/release/bundle"
artifact-path: "GarageScouter-Linux.tar.gz"
artifact-name: GarageScouter-Linux
- os: ubuntu-22.04
build-option: "apk"
build-path: "build/app/outputs/flutter-apk/app-release.apk"
artifact-path: "GarageScouter-Android.apk"
artifact-name: GarageScouter-Android
name: "Build - ${{ matrix.artifact-name }}"
needs: [formatting-analysis, test]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install flutter deps
if: ${{ matrix.build-option == 'linux' }}
run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build libgtk-3-dev
- name: Setup flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
cache-path: ${{ runner.tool_cache }}/flutter/${{ matrix.build-option }}
- name: Get dependencies
run: flutter pub get
- name: Build App Icons
run: dart run flutter_launcher_icons
- name: Build Isar
run: dart run build_runner build
# - name: Set dev version env
# if: ${{ github.event_name != 'workflow_dispatch' && matrix.build-option != 'windows' }}
# run: echo "VERSION_NAME=0.0.0-dev-${{ github.run_number }}" >> $GITHUB_ENV
# - name: Set pubspec version
# run: |
# flutter pub global activate cider
# dart run cider version "${{ env.VERSION_NAME }}+${{ github.run_number }}"
- name: Build app
run: flutter build ${{ matrix.build-option }}
- name: Zip release (Mac)
if: ${{ matrix.build-option == 'macos' }}
run: |
cd build/macos/Build/Products/Release
zip -r ${{ matrix.artifact-name }}.zip GarageScouter.app --symlinks
- name: Zip release (Windows)
if: ${{ matrix.build-option == 'windows' }}
run: |
Compress-Archive -Path ${{ matrix.build-path }}\* -DestinationPath ${{ matrix.artifact-name }}
- name: Zip release (Linux)
if: ${{ matrix.build-option == 'linux' }}
run: |
tar -czvf ${{ matrix.artifact-path }} ${{ matrix.build-path }}
- name: Rename release (Android)
if: ${{ matrix.build-option == 'apk' }}
run: |
mv ${{ matrix.build-path }} ${{ matrix.artifact-path }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}
path: ${{ matrix.artifact-path }}
release:
needs: [build]
runs-on: ubuntu-22.04
steps:
- uses: actions/download-artifact@v4
- run: find
- uses: pyTooling/Actions/releaser@r0
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: 'dev'
rm: true
files: |
**/*.zip
**/*.app
**/*.apk
**/*.tar.gz
if: github.event_name == 'push'
- uses: softprops/action-gh-release@v1
with:
files: |
**/*.zip
**/*.app
**/*.apk
**/*.tar.gz
if: startsWith(github.ref, 'refs/tags/v')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}