diff --git a/.github/workflows/run.yml b/.github/workflows/run.yml index 4d23801..55b6309 100644 --- a/.github/workflows/run.yml +++ b/.github/workflows/run.yml @@ -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 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ebb7d96 --- /dev/null +++ b/LICENSE @@ -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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..a7ae29c --- /dev/null +++ b/README.md @@ -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)](.) +Monterail's logo + +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. + +
+ +```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 +``` + +
+ +### 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. + +
+ +```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 +``` + +
diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..af79231 --- /dev/null +++ b/SECURITY.md @@ -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. diff --git a/action.yml b/action.yml index c9e77f6..a85291b 100644 --- a/action.yml +++ b/action.yml @@ -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' @@ -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 }} \ No newline at end of file + shell: bash + - run: $GITHUB_ACTION_PATH/install-flutter-sdk.sh -c ${{ inputs.channel }} + shell: bash \ No newline at end of file diff --git a/doc/assets/monterail_logo.svg b/doc/assets/monterail_logo.svg new file mode 100644 index 0000000..7dedfe6 --- /dev/null +++ b/doc/assets/monterail_logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/install-flutter-sdk.sh b/install-flutter-sdk.sh index 7b5718b..380b3d6 100644 --- a/install-flutter-sdk.sh +++ b/install-flutter-sdk.sh @@ -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"