loading...
Cover image for Actionshackathon Journey with Github actions and Flutter

Actionshackathon Journey with Github actions and Flutter

maverikai profile image Aditya ・1 min read

My Workflow

The GitHub Action Flutter CI is designed to automate certain tasks for the developers making their life less complicated.

  • Configuring Flutter version
  • Installing dependencies
  • Run Tests
  • Build the app
  • Download the artifacts

Submission Category:

Maintainer Must-Haves and Wacky Wildcards

Yaml File or Link to Code

name: Flutter CI

# This workflow is triggered on pushes to the repository.

on:
  push:
    branches:
    - master

# on: push    # Default will running for every branch.

jobs:
  build:
    # This job will run on ubuntu virtual machine
    runs-on: ubuntu-latest
    steps:

    # Setup Java environment in order to build the Android app.
    - uses: actions/checkout@v1
    - uses: actions/setup-java@v1
      with:
        java-version: '12.x'

    # Setup the flutter environment.
    - uses: subosito/flutter-action@v1
      with:
        channel: 'stable' # 'dev', 'alpha', default to: 'stable'
        flutter-version: '1.17.5' # you can also specify exact version of flutter

    # Get flutter dependencies.
    - name: Install dependencies
      run: flutter pub get    
    - name: Build apk
      run: flutter build apk --debug --split-per-abi

    # Upload generated apk to the artifacts.
    - uses: actions/upload-artifact@v1
      with:
        name: release-apk
        path: build/app/outputs/apk/release/app-release.apk

KiiT Archives

KiiT Archives is an app specifically for the students of KiiT University, Bhubaneshwar. Providing Engineering students notes for each and every subjects.

Feel Free To Contribute

Additional Resources / Info

GitHub logo subosito / flutter-action

Flutter environment for use in actions. It works on Linux, Windows, and macOS.

flutter-action

This action sets up a flutter environment for use in actions. It works on Linux, Windows, and macOS.

Usage

steps
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
  with
    java-version: '12.x'
- uses: subosito/flutter-action@v1
  with
    flutter-version: '1.9.1+hotfix.6'
- run: flutter pub get
- run: flutter test
- run: flutter build apk

Build for iOS too (macOS only):

jobs:
  build:
    runs-on: macos-latest
    steps:
    - uses: actions/checkout@v1
    - uses: actions/setup-java@v1
      with:
        java-version: '12.x'
    - uses: subosito/flutter-action@v1
      with:
        flutter-version: '1.9.1+hotfix.6'
    - run: flutter pub get
    - run: flutter test
    - run: flutter build apk
    - run: flutter build ios --release --no-codesign

Use app bundle, instead of APK:

steps
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
  with:
    java-version

Upload-Artifact v2

This uploads artifacts from your workflow allowing you to share data between jobs and store data once a workflow is complete.

See also download-artifact.

What's new

  • Easier upload
    • Specify a wildcard pattern
    • Specify an individual file
    • Specify a directory (previously you were limited to only this option)
    • Multi path upload
      • Use a combination of individual files, wildcards or directories
      • Support for excluding certain files
  • Upload an artifact without providing a name
  • Fix for artifact uploads sometimes not working with containers
  • Proxy support out of the box
  • Port entire action to typescript from a runner plugin so it is easier to collaborate and accept contributions

Refer here for the previous version

Usage

See action.yml

Upload an Individual File

steps
- uses: actions/checkout@v2
- run: mkdir -p path/to/artifact
- run: echo hello > path/to/artifact/world.txt
- uses: actions/upload-artifact@v2
  with:
    name: my-artifact
    path: 

Download-Artifact v2

This downloads artifacts from your build

See also upload-artifact.

What's new

  • Download all artifacts at once
  • Output parameter for the download path
  • Port entire action to typescript from a runner plugin so it is easier to collaborate and accept contributions

Refer here for the previous version

Usage

See action.yml

Download a Single Artifact

Basic (download to the current working directory):

steps
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
  with
    name: my-artifact
    
- name: Display structure of downloaded files
  run: ls -R

Download to a specific directory:

steps:
- uses: actions/checkout@v2

- uses: actions/download-artifact@v2
  with:
    name: my-artifact
    path: path/to/artifact
    
- name: Display structure of downloaded files
  run: ls -R
  working-directory: path/to/artifact

Basic tilde expansion is supported for the path input:

  - uses: actions/download-artifact@v2
    with:
      name: my-artifact
      path: ~/download/path

Compatibility

Discussion

pic
Editor guide