Skip to content

Commit

Permalink
ci: add Github Action workflows
Browse files Browse the repository at this point in the history
- Specified Flutter environment version in pubspec.yaml
- Add version constraint to `custom_lint` and `riverpod_lint`
- Add check.yml workflow
- Add build.yml workflow
  • Loading branch information
brainwo committed Apr 26, 2024
1 parent 76aa695 commit 092fa00
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 4 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Build release tag
on:
push:
tags:
- "v*"
workflow_dispatch:

jobs:
build:
name: Create ${{ matrix.os }} build
runs-on: ${{ matrix.os }}
strategy:
matrix:
target: [Linux]
include:
- os: ubuntu-latest
target: Linux
build_target: linux
build_path: build/linux/x64/release/bundle
asset_name: linux_amd64
asset_extension: .tar.gz
asset_content_type: application/gzip
fail-fast: false
steps:
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version-flie: pubspec.yaml
- name: Install Linux dependencies
if: matrix.target == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y clang cmake ninja-build libgtk-3-dev libstdc++-12-dev
- uses: actions/checkout@v2
- run: |
flutter config --enable-linux-desktop
flutter config --no-analytics
dart --disable-analytics
flutter config --no-enable-android
flutter config --no-enable-web
- run: flutter doctor -v
- run: flutter pub get
- run: dart fix --apply --code=unnecessary_final
- run: flutter build -v ${{ matrix.build_target }} --release
- name: Compress build for Linux
if: matrix.target == 'Linux'
run: tar czf $GITHUB_WORKSPACE/yatta_${{ matrix.build_target }}${{ matrix.asset_extension }} *
working-directory: ${{ matrix.build_path }}
- name: Upload the artifact to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
release_name: Release ${{ github.ref_name }}
file: yatta_${{ matrix.build_target }}${{ matrix.asset_extension }}
tag: ${{ github.ref }}
asset_name: yatta_${{ github.ref_name }}_${{ matrix.asset_name }}${{ matrix.asset_extension }}
overwrite: true
33 changes: 33 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Code check

on:
push:
branches:
- main
pull_request:
types:
- opened
- reopened
- synchronize

jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version-flie: pubspec.yaml
- name: Update dependencies
run: flutter pub get
- name: Disable analytics
run: |
flutter config --no-analytics
dart --disable-analytics
- name: Remove custom lint # https://github.com/invertase/dart_custom_lint/issues/228
run: sed -i '/custom_lint/d' analysis_options.yaml
- name: Format
run: dart format --set-exit-if-changed lib
- name: Analyze
run: flutter analyze lib
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -890,4 +890,4 @@ packages:
version: "1.0.3"
sdks:
dart: ">=3.3.3 <4.0.0"
flutter: ">=3.19.0"
flutter: ">=3.19.6"
7 changes: 4 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ description: A multipurpose YouTube frontend for hackers

publish_to: "none"

version: 0.0.0
version: 0.0.2

environment:
sdk: ">=3.0.0 <4.0.0"
flutter: 3.19.6

dependencies:
autoscroll:
Expand All @@ -21,11 +22,11 @@ dependencies:
path: package/youtube_api/

dev_dependencies:
custom_lint:
custom_lint: ^0.6.4
extra_pedantic: ^4.0.0
flutter_test:
sdk: flutter
riverpod_lint:
riverpod_lint: ^2.3.10
test: ^1.21.0

flutter:
Expand Down

0 comments on commit 092fa00

Please sign in to comment.