Skip to content

Commit

Permalink
feat: add action and add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
wrbl606 committed Mar 18, 2024
1 parent 5cddfc4 commit 8c0b4ae
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 13 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ on:

jobs:
test-install:

runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]

strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: ./
with: stable
- run: flutter --version
- run: dart pub global activate git_helper && git_helper -h
7 changes: 7 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2024 Marcin Wróblewski

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
98 changes: 98 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Flutter SDK for GitHub Actions

[![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](.)
<img src="./doc/assets/monterail_logo.svg" alt="Monterail's logo" width="25%" height="100" align="right"/>

Flutter and Dart in your GitHub Actions. Use effortlessly in your project, inspire yourself with our [Recipes](#recipes).

## Installation

Copy and paste the following snippet into your action's `.yml` file.

```yaml
- name: Install Flutter
uses: monterail/flutter-action@v1
```
## Usage
With Flutter SDK for GitHub Actions you can do the following:
```yaml
steps:
- uses: monterail/flutter-action@v1
- run: flutter build ...
```
### Action arguments
`monterail/flutter-action@v1` provides sane defaults, assuming the default usage is to get the newest, production-ready, Flutter SDK. For more complex use-cases, customize the action with the non-standard inputs.

| Name | Description | Default |
| --- | --- | --- |
| `channel` | Flutter [channel](https://github.com/flutter/flutter/wiki/Flutter-build-release-channels) | `stable` |

## Recipes

List of practical applications of `monterail/flutter-action@v1` for your project. Click the `Details` dropdown to see the implementation. Test the recipe by putting it into `.github/workflows/action.yml` file in your project's repository.

### Assure code quality standard for each PR

Will check (and annotate, if necessary) code quality and formatting guidelines set in `analysis_options.yaml`. Once code quality is checked, will run tests.

<details>

```yaml
name: Lint and Test PRs
on:
pull_request:
branches:
- main
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: monterail/flutter-action@v1
- run: flutter pub get
- uses: invertase/github-action-dart-analyzer@v3
with:
annotate: true
- run: dart format --set-exit-if-changed --output none
- run: flutter test
```

</details>

### Build web project artifact on each `main` push

Load project's dependencies and build web app into a `.zip` file, stored as an artifact for the given commit.

<details>

```yaml
name: Build web app
on:
push:
branches:
- main
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: monterail/flutter-action@v1
- run: flutter pub get
- run: flutter build web
- uses: actions/upload-artifact@v4
with:
name: web-app
path: build/web
```

</details>
7 changes: 7 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Handling Security Vulnerabilities

In order to maintain responsible disclosure practices, we request that you do not submit security vulnerabilities or pull requests on GitHub, as this information could be exploited by malicious actors. We recommend that you report any security vulnerabilities directly to our security team via email at:

[services@monterail.com](services@monterail.com)

Our team will review your report and take appropriate action to address the issue.
9 changes: 7 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: 'Install Flutter SDK'
description: 'Make dart and flutter CLI available for your action'
description: 'Dart and Flutter CLIs available for your GitHub Action'
author: 'Marcin Wróblewski'
branding:
color: 'white'
icon: 'download'
inputs:
channel:
description: 'Desired Flutter channel'
Expand All @@ -10,4 +13,6 @@ runs:
using: 'composite'
steps:
- run: chmod +x $GITHUB_ACTION_PATH/install-flutter-sdk.sh
- run: $GITHUB_ACTION_PATH/install-flutter-sdk.sh -c ${{ inputs.channel }}
shell: bash
- run: $GITHUB_ACTION_PATH/install-flutter-sdk.sh -c ${{ inputs.channel }}
shell: bash
1 change: 1 addition & 0 deletions doc/assets/monterail_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 4 additions & 5 deletions install-flutter-sdk.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
#!/bin/bash

CHANNEL="stable"
while getopts 'v:' param; do
while getopts 'v:c:' param; do
case $param in
v) CHANNEL="$OPTARG" ;;
c) CHANNEL="$OPTARG" ;;
esac
done

if [ -z "$CHANNEL" ]; then

FLUTTER_PATH="$GITHUB_ACTION_PATH/flutter"
git clone -b "$CHANNEL" https://github.com/flutter/flutter.git "$FLUTTER_PATH"

{
echo "$FLUTTER_PATH/bin"
echo "$FLUTTER_PATH/bin/cache/dart-sdk/bin"
echo "$HOME/.pub-cache"
echo "$HOME/.pub-cache/bin" # POSIX
echo "$LOCALAPPDATA\Pub\Cache\bin" # Windows
} >> "$GITHUB_PATH"

0 comments on commit 8c0b4ae

Please sign in to comment.