From 4061fd4afbbfc8e2ce86381bcd02b44a1938fb8d Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 1 Apr 2024 02:02:30 +0200 Subject: [PATCH 01/14] minor readme fixes --- README.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 3a139243..9ad175a5 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,8 @@ steps: - name: Set up Flutter uses: subosito/flutter-action@v2 with: - flutter-version: 3.19.0 channel: stable + flutter-version: 3.19.0 - run: flutter --version ``` @@ -43,8 +43,8 @@ steps: - name: Set up Flutter uses: subosito/flutter-action@v2 with: - flutter-version: 1.22.x channel: dev + flutter-version: 1.22.x - run: flutter --version ``` @@ -57,8 +57,8 @@ steps: - name: Set up Flutter uses: subosito/flutter-action@v2 with: - flutter-version: 3.x channel: any + flutter-version: 3.x - run: flutter --version ``` @@ -71,8 +71,8 @@ steps: - name: Set up Flutter uses: subosito/flutter-action@v2 with: - flutter-version: 5b12b74 # tag, commit or branch channel: master + flutter-version: 5b12b74 # tag, commit or branch - run: flutter --version ``` @@ -121,7 +121,7 @@ steps: - name: Set up Flutter uses: subosito/flutter-action@v2 with: - channel: "stable" + channel: stable - run: flutter pub get - run: flutter test - run: flutter build web @@ -174,7 +174,7 @@ jobs: - name: Set up Flutter uses: subosito/flutter-action@v2 with: - channel: "stable" + channel: stable - run: flutter build macos ``` @@ -220,7 +220,9 @@ steps: id: flutter-action with: channel: stable - - run: | + - name: Print outputs + shell: bash + run: | echo CACHE-PATH=${{ steps.flutter-action.outputs.CACHE-PATH }} echo CACHE-KEY=${{ steps.flutter-action.outputs.CACHE-KEY }} echo CHANNEL=${{ steps.flutter-action.outputs.CHANNEL }} @@ -228,5 +230,4 @@ steps: echo ARCHITECTURE=${{ steps.flutter-action.outputs.ARCHITECTURE }} echo PUB-CACHE-PATH=${{ steps.flutter-action.outputs.PUB-CACHE-PATH }} echo PUB-CACHE-KEY=${{ steps.flutter-action.outputs.PUB-CACHE-KEY }} - shell: bash ``` From 8d4f976e2bc16657dc4aad70d84596054fc259dc Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 1 Apr 2024 02:11:46 +0200 Subject: [PATCH 02/14] update README with new info --- README.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/README.md b/README.md index 9ad175a5..eca4d45d 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,40 @@ steps: - run: flutter --version ``` +Use version from pubspec.yaml: + +```yaml +steps: + - name: Clone repository + uses: actions/checkout@v4 + - name: Set up Flutter + uses: subosito/flutter-action@v2 + with: + channel: stable + flutter-version-file: pubspec.yaml # path to pubspec.yaml + - run: flutter --version +``` + +> [!IMPORTANT] +> For `flutter-version-file` to work, you need to have the exact Flutter version +> defined in your pubspec.yaml: +> +> **Good** +> +> ```yaml +> environment: +> sdk: ">=3.3.0 <4.0.0" +> flutter: 3.19.0 +> ``` +> +> **Bad** +> +> ```yaml +> environment: +> sdk: ">=3.3.0 <4.0.0" +> flutter: ">= 3.19.0 <4.0.0" +> ``` + Use latest release for particular channel: ```yaml From 723e3d8893f675641afec0974edbdcd064c56d1c Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 1 Apr 2024 02:13:24 +0200 Subject: [PATCH 03/14] setup.sh: update arg parsing to add support for `flutter-version-file` as `-f pubspec.yaml` --- setup.sh | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/setup.sh b/setup.sh index b411a2b0..6f73ea67 100755 --- a/setup.sh +++ b/setup.sh @@ -5,7 +5,12 @@ check_command() { } if ! check_command jq; then - echo "jq not found, please install it, https://stedolan.github.io/jq/download/" + echo "jq not found. Install it from https://stedolan.github.io/jq" + exit 1 +fi + +if ! check_command yq; then + echo "yq not found. Install it from https://mikefarah.gitbook.io/yq" exit 1 fi @@ -76,8 +81,9 @@ PRINT_ONLY="" TEST_MODE=false ARCH="" VERSION="" +VERSION_FILE="" -while getopts 'tc:k:d:l:pa:n:' flag; do +while getopts 'tc:k:d:l:pa:n:f:' flag; do case "$flag" in c) CACHE_PATH="$OPTARG" ;; k) CACHE_KEY="$OPTARG" ;; @@ -87,12 +93,24 @@ while getopts 'tc:k:d:l:pa:n:' flag; do t) TEST_MODE=true ;; a) ARCH="$(echo "$OPTARG" | awk '{print tolower($0)}')" ;; n) VERSION="$OPTARG" ;; + f) VERSION_FILE="$OPTARG" ;; ?) exit 2 ;; esac done [ -z "$ARCH" ] && ARCH="$ARCH_NAME" + + +if [ -n "$VERSION_FILE" ]; then + if [ -n "$VERSION" ]; then + echo "Cannot specify both a version and a version file" + exit 1 + fi + + VERSION="$(yq '.environment.flutter' "$VERSION_FILE")" +fi + ARR_CHANNEL=("${@:$OPTIND:1}") CHANNEL="${ARR_CHANNEL[0]}" From 50c34bfe35ffded698323ee0925f12f6ed4fc843 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 1 Apr 2024 02:20:42 +0200 Subject: [PATCH 04/14] action.yaml: add flutter-version-file --- action.yaml | 53 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/action.yaml b/action.yaml index 36cd8edd..b5c90616 100644 --- a/action.yaml +++ b/action.yaml @@ -6,14 +6,22 @@ branding: color: blue inputs: + channel: + description: The Flutter build release channel + required: false + default: stable flutter-version: description: The Flutter version to make available on the path required: false default: any - channel: - description: The Flutter build release channel + flutter-version-file: + description: The pubspec.yaml file with exact Flutter version defined required: false - default: stable + default: "" + architecture: + description: The architecture of Flutter SDK executable (x64 or arm64) + required: false + default: "${{ runner.arch }}" cache: description: Cache the Flutter SDK required: false @@ -22,39 +30,38 @@ inputs: description: Identifier for the Flutter SDK cache required: false default: "flutter-:os:-:channel:-:version:-:arch:-:hash:" - pub-cache-key: - description: Identifier for the Dart .pub-cache cache - required: false - default: "flutter-pub:os:-:channel:-:version:-:arch:-:hash:" cache-path: description: Flutter SDK cache path required: false default: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" + pub-cache-key: + description: Identifier for the Dart .pub-cache cache + required: false + default: "flutter-pub:os:-:channel:-:version:-:arch:-:hash:" pub-cache-path: description: Flutter pub cache path required: false default: default - architecture: - description: The architecture of Flutter SDK executable (x64 or arm64) - required: false - default: "${{ runner.arch }}" outputs: - CACHE-KEY: - value: "${{ steps.flutter-action.outputs.CACHE-KEY }}" - description: Key used to cache the Flutter SDK - CACHE-PATH: - value: "${{ steps.flutter-action.outputs.CACHE-PATH }}" - description: Path to Flutter SDK CHANNEL: value: "${{ steps.flutter-action.outputs.CHANNEL }}" description: The selected Flutter release channel VERSION: value: "${{ steps.flutter-action.outputs.VERSION }}" description: The selected Flutter version + VERSION_FILE: + value: "${{ steps.flutter-action.outputs.VERSION_FILE }}" + description: The pubspec.yaml file with exact Flutter version defined ARCHITECTURE: value: "${{ steps.flutter-action.outputs.ARCHITECTURE }}" description: The selected Flutter CPU architecture + CACHE-KEY: + value: "${{ steps.flutter-action.outputs.CACHE-KEY }}" + description: Key used to cache the Flutter SDK + CACHE-PATH: + value: "${{ steps.flutter-action.outputs.CACHE-PATH }}" + description: Path to Flutter SDK PUB-CACHE-KEY: value: "${{ steps.flutter-action.outputs.PUB-CACHE-KEY }}" description: Key used to cache the pub dependencies @@ -74,12 +81,13 @@ runs: shell: bash run: | $GITHUB_ACTION_PATH/setup.sh -p \ - -c '${{ inputs.cache-path }}' \ - -k '${{ inputs.cache-key }}' \ - -d '${{ inputs.pub-cache-path }}' \ - -l '${{ inputs.pub-cache-key }}' \ -n '${{ inputs.flutter-version }}' \ + -f '${{ inputs.flutter-version-file }}' \ -a '${{ inputs.architecture }}' \ + -k '${{ inputs.cache-key }}' \ + -c '${{ inputs.cache-path }}' \ + -l '${{ inputs.pub-cache-key }}' \ + -d '${{ inputs.pub-cache-path }}' \ ${{ inputs.channel }} - name: Cache Flutter @@ -105,7 +113,8 @@ runs: shell: bash run: | $GITHUB_ACTION_PATH/setup.sh \ - -c '${{ steps.flutter-action.outputs.CACHE-PATH }}' \ -n '${{ steps.flutter-action.outputs.VERSION }}' \ + -f '${{ steps.flutter-action.outputs.VERSION_FILE }}' \ -a '${{ steps.flutter-action.outputs.ARCHITECTURE }}' \ + -c '${{ steps.flutter-action.outputs.CACHE-PATH }}' \ ${{ steps.flutter-action.outputs.CHANNEL }} From d885ff9f4710681707ddef407ea969f0d1a31d6a Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 1 Apr 2024 02:23:20 +0200 Subject: [PATCH 05/14] setup.sh: require `yq` only when -f option is specified --- setup.sh | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/setup.sh b/setup.sh index 6f73ea67..60deb618 100755 --- a/setup.sh +++ b/setup.sh @@ -9,11 +9,6 @@ if ! check_command jq; then exit 1 fi -if ! check_command yq; then - echo "yq not found. Install it from https://mikefarah.gitbook.io/yq" - exit 1 -fi - OS_NAME=$(echo "$RUNNER_OS" | awk '{print tolower($0)}') ARCH_NAME=$(echo "$RUNNER_ARCH" | awk '{print tolower($0)}') MANIFEST_BASE_URL="https://storage.googleapis.com/flutter_infra_release/releases" @@ -93,15 +88,19 @@ while getopts 'tc:k:d:l:pa:n:f:' flag; do t) TEST_MODE=true ;; a) ARCH="$(echo "$OPTARG" | awk '{print tolower($0)}')" ;; n) VERSION="$OPTARG" ;; - f) VERSION_FILE="$OPTARG" ;; + f) + VERSION_FILE="$OPTARG" + if [ -n "$VERSION_FILE" ] && ! check_command yq; then + echo "yq not found. Install it from https://mikefarah.gitbook.io/yq" + exit 1 + fi + ;; ?) exit 2 ;; esac done [ -z "$ARCH" ] && ARCH="$ARCH_NAME" - - if [ -n "$VERSION_FILE" ]; then if [ -n "$VERSION" ]; then echo "Cannot specify both a version and a version file" From ad0b5cabca9112b502dd507a813a493b5ecdd4d3 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 1 Apr 2024 02:34:15 +0200 Subject: [PATCH 06/14] fix tests --- .github/workflows/workflow.yaml | 2 ++ test/pubspec.yaml | 5 +++++ 2 files changed, 7 insertions(+) create mode 100644 test/pubspec.yaml diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index 00964ff9..c40263f8 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -82,6 +82,8 @@ jobs: steps: - name: Clone repository uses: actions/checkout@v4 + - run: ./setup.sh -t -p -f test/pubspec.yaml | grep '3.3.10' + shell: bash - run: ./setup.sh -t -p | grep 'stable' shell: bash - run: ./setup.sh -t -p | grep '3.7.7' diff --git a/test/pubspec.yaml b/test/pubspec.yaml new file mode 100644 index 00000000..b4d58fad --- /dev/null +++ b/test/pubspec.yaml @@ -0,0 +1,5 @@ +name: flutter_action_test + +environment: + dart: ">=2.18.0 <3.0.0" + flutter: 3.3.10 From 228763f42b52a52be86af4bdc490b6a2fba5e6a1 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 1 Apr 2024 02:41:21 +0200 Subject: [PATCH 07/14] enable shell options: `errexit` and `nounset` --- setup.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/setup.sh b/setup.sh index 60deb618..e3a7491e 100755 --- a/setup.sh +++ b/setup.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -eu check_command() { command -v "$1" >/dev/null 2>&1 @@ -102,7 +103,7 @@ done [ -z "$ARCH" ] && ARCH="$ARCH_NAME" if [ -n "$VERSION_FILE" ]; then - if [ -n "$VERSION" ]; then + if [ -n "$VERSION" ] || [ "$VERSION" != "any" ] ; then echo "Cannot specify both a version and a version file" exit 1 fi @@ -111,7 +112,7 @@ if [ -n "$VERSION_FILE" ]; then fi ARR_CHANNEL=("${@:$OPTIND:1}") -CHANNEL="${ARR_CHANNEL[0]}" +CHANNEL="${ARR_CHANNEL[0]:-}" [ -z "$CHANNEL" ] && CHANNEL=stable [ -z "$VERSION" ] && VERSION=any @@ -127,7 +128,7 @@ CHANNEL="${ARR_CHANNEL[0]}" # If `PUB_CACHE` is set already, then it should continue to be used. Otherwise, satisfy it # if the action requests a custom path, or set to the Dart default values depending # on the operating system. -if [ -z "$PUB_CACHE" ]; then +if [ -z "${PUB_CACHE:-}" ]; then if [ "$PUB_CACHE_PATH" != "default" ]; then PUB_CACHE="$PUB_CACHE_PATH" elif [ "$OS_NAME" = "windows" ]; then @@ -203,7 +204,7 @@ if [ "$PRINT_ONLY" = true ]; then echo "CACHE-PATH=$CACHE_PATH" echo "PUB-CACHE-KEY=$PUB_CACHE_KEY" echo "PUB-CACHE-PATH=$PUB_CACHE" - } >>"$GITHUB_OUTPUT" + } >>"${GITHUB_OUTPUT:-/dev/null}" exit 0 fi @@ -224,10 +225,10 @@ fi { echo "FLUTTER_ROOT=$CACHE_PATH" echo "PUB_CACHE=$PUB_CACHE" -} >>"$GITHUB_ENV" +} >>"${GITHUB_ENV:-/dev/null}" { echo "$CACHE_PATH/bin" echo "$CACHE_PATH/bin/cache/dart-sdk/bin" echo "$PUB_CACHE/bin" -} >>"$GITHUB_PATH" +} >>"${GITHUB_PATH:-/dev/null}" From ac2ffe2621e065f3f574748ef8234b97546b1e9c Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 1 Apr 2024 03:11:44 +0200 Subject: [PATCH 08/14] add test for flutter-version-file --- .github/workflows/workflow.yaml | 21 +++++++++++++++++++++ action.yaml | 2 +- setup.sh | 2 +- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index c40263f8..ac002688 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -76,6 +76,27 @@ jobs: - run: flutter --version shell: bash + test_version_file: + runs-on: ${{ matrix.operating-system }} + + strategy: + matrix: + operating-system: [ubuntu-latest] + + steps: + - name: Clone repository + uses: actions/checkout@v4 + - uses: ./ + with: + channel: stable + flutter-version-file: test/pubspec.yaml + - name: Verify Dart version + run: dart --version | grep '2.18.6' + shell: bash + - name: Verify Flutter version + run: flutter --version | grep '3.3.10' + shell: bash + test_print_output: runs-on: macos-latest diff --git a/action.yaml b/action.yaml index b5c90616..1b2144c2 100644 --- a/action.yaml +++ b/action.yaml @@ -13,7 +13,7 @@ inputs: flutter-version: description: The Flutter version to make available on the path required: false - default: any + default: "" flutter-version-file: description: The pubspec.yaml file with exact Flutter version defined required: false diff --git a/setup.sh b/setup.sh index e3a7491e..7b0d104b 100755 --- a/setup.sh +++ b/setup.sh @@ -103,7 +103,7 @@ done [ -z "$ARCH" ] && ARCH="$ARCH_NAME" if [ -n "$VERSION_FILE" ]; then - if [ -n "$VERSION" ] || [ "$VERSION" != "any" ] ; then + if [ -n "$VERSION" ]; then echo "Cannot specify both a version and a version file" exit 1 fi From 729f3f4296a0555aff201575500851616f64a8b0 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 1 Apr 2024 03:29:45 +0200 Subject: [PATCH 09/14] move falling back to defaults to single place - setup.sh --- action.yaml | 6 +++--- setup.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/action.yaml b/action.yaml index 1b2144c2..a74581ec 100644 --- a/action.yaml +++ b/action.yaml @@ -29,15 +29,15 @@ inputs: cache-key: description: Identifier for the Flutter SDK cache required: false - default: "flutter-:os:-:channel:-:version:-:arch:-:hash:" + default: "" cache-path: description: Flutter SDK cache path required: false - default: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" + default: "" pub-cache-key: description: Identifier for the Dart .pub-cache cache required: false - default: "flutter-pub:os:-:channel:-:version:-:arch:-:hash:" + default: "" pub-cache-path: description: Flutter pub cache path required: false diff --git a/setup.sh b/setup.sh index 7b0d104b..76f2f1be 100755 --- a/setup.sh +++ b/setup.sh @@ -117,7 +117,7 @@ CHANNEL="${ARR_CHANNEL[0]:-}" [ -z "$CHANNEL" ] && CHANNEL=stable [ -z "$VERSION" ] && VERSION=any [ -z "$ARCH" ] && ARCH=x64 -[ -z "$CACHE_PATH" ] && CACHE_PATH="$RUNNER_TEMP/flutter/:channel:-:version:-:arch:" +[ -z "$CACHE_PATH" ] && CACHE_PATH="$RUNNER_TOOL_CACHE/flutter/:channel:-:version:-:arch:" [ -z "$CACHE_KEY" ] && CACHE_KEY="flutter-:os:-:channel:-:version:-:arch:-:hash:" [ -z "$PUB_CACHE_KEY" ] && PUB_CACHE_KEY="flutter-pub-:os:-:channel:-:version:-:arch:-:hash:" [ -z "$PUB_CACHE_PATH" ] && PUB_CACHE_PATH="default" From 4c5e7d12f8d861cfe156c3c94d1744c77698d75c Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 1 Apr 2024 03:41:31 +0200 Subject: [PATCH 10/14] debug --- .github/workflows/workflow.yaml | 5 ++++- setup.sh | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index ac002688..b25a859d 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -103,7 +103,10 @@ jobs: steps: - name: Clone repository uses: actions/checkout@v4 - - run: ./setup.sh -t -p -f test/pubspec.yaml | grep '3.3.10' + - run: | + ./setup.sh -t -p -f test/pubspec.yaml | grep '3.3.10' + echo "RUNNER_TOOL_CACHE: $RUNNER_TOOL_CACHE" + echo "RUNNER_TEMP: $RUNNER_TEMP" shell: bash - run: ./setup.sh -t -p | grep 'stable' shell: bash diff --git a/setup.sh b/setup.sh index 76f2f1be..9cce2cc2 100755 --- a/setup.sh +++ b/setup.sh @@ -188,6 +188,7 @@ if [ "$PRINT_ONLY" = true ]; then if [ "$TEST_MODE" = true ]; then echo "CHANNEL=$info_channel" echo "VERSION=$info_version" + # VERSION_FILE is not printed, because it is essentially same as VERSION echo "ARCHITECTURE=$info_architecture" echo "CACHE-KEY=$CACHE_KEY" echo "CACHE-PATH=$CACHE_PATH" @@ -199,6 +200,7 @@ if [ "$PRINT_ONLY" = true ]; then { echo "CHANNEL=$info_channel" echo "VERSION=$info_version" + # VERSION_FILE is not printed, because it is essentially same as VERSION echo "ARCHITECTURE=$info_architecture" echo "CACHE-KEY=$CACHE_KEY" echo "CACHE-PATH=$CACHE_PATH" From 72d56ba498685fc898703a524eb1d6273f1e89aa Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 1 Apr 2024 03:43:51 +0200 Subject: [PATCH 11/14] fix tests --- .github/workflows/workflow.yaml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index b25a859d..187c4328 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -103,10 +103,7 @@ jobs: steps: - name: Clone repository uses: actions/checkout@v4 - - run: | - ./setup.sh -t -p -f test/pubspec.yaml | grep '3.3.10' - echo "RUNNER_TOOL_CACHE: $RUNNER_TOOL_CACHE" - echo "RUNNER_TEMP: $RUNNER_TEMP" + - run: ./setup.sh -t -p -f test/pubspec.yaml | grep '3.3.10' shell: bash - run: ./setup.sh -t -p | grep 'stable' shell: bash @@ -172,15 +169,15 @@ jobs: shell: bash - run: ./setup.sh -t -p -n 0 any | grep 'flutter-macos-beta-0.11.13-x64-58c8489fcdb4e4ef6c010117584c9b23d15221aa' shell: bash - - run: ./setup.sh -t -p | grep '/Users/runner/work/_temp/flutter/stable-3.7.7-x64' + - run: ./setup.sh -t -p | grep '/Users/runner/hostedtoolcache/flutter/stable-3.7.7-x64' shell: bash - - run: ./setup.sh -t -p stable | grep '/Users/runner/work/_temp/flutter/stable-3.7.7-x64' + - run: ./setup.sh -t -p stable | grep '/Users/runner/hostedtoolcache/flutter/stable-3.7.7-x64' shell: bash - - run: ./setup.sh -t -p beta | grep '/Users/runner/work/_temp/flutter/beta-3.9.0-0.1.pre-x64' + - run: ./setup.sh -t -p beta | grep '/Users/runner/hostedtoolcache/flutter/beta-3.9.0-0.1.pre-x64' shell: bash - - run: ./setup.sh -t -p dev | grep '/Users/runner/work/_temp/flutter/dev-2.11.0-0.1.pre-x64' + - run: ./setup.sh -t -p dev | grep '/Users/runner/hostedtoolcache/flutter/dev-2.11.0-0.1.pre-x64' shell: bash - - run: ./setup.sh -t -p master | grep '/Users/runner/work/_temp/flutter/master-any-x64' + - run: ./setup.sh -t -p master | grep '/Users/runner/hostedtoolcache/flutter/master-any-x64' shell: bash - run: ./setup.sh -t -p -k 'custom-:channel:-:version:-:hash:' | grep 'custom-stable-3.7.7-2ad6cd72c040113b47ee9055e722606a490ef0da' shell: bash From 3061b99ad9c8030922d067128d9fc5b34c25f241 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 1 Apr 2024 03:44:42 +0200 Subject: [PATCH 12/14] action.yaml: reduce number of arguments in the last invocation --- action.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/action.yaml b/action.yaml index a74581ec..6594f64f 100644 --- a/action.yaml +++ b/action.yaml @@ -50,9 +50,6 @@ outputs: VERSION: value: "${{ steps.flutter-action.outputs.VERSION }}" description: The selected Flutter version - VERSION_FILE: - value: "${{ steps.flutter-action.outputs.VERSION_FILE }}" - description: The pubspec.yaml file with exact Flutter version defined ARCHITECTURE: value: "${{ steps.flutter-action.outputs.ARCHITECTURE }}" description: The selected Flutter CPU architecture @@ -114,7 +111,6 @@ runs: run: | $GITHUB_ACTION_PATH/setup.sh \ -n '${{ steps.flutter-action.outputs.VERSION }}' \ - -f '${{ steps.flutter-action.outputs.VERSION_FILE }}' \ -a '${{ steps.flutter-action.outputs.ARCHITECTURE }}' \ -c '${{ steps.flutter-action.outputs.CACHE-PATH }}' \ ${{ steps.flutter-action.outputs.CHANNEL }} From 8897c3df001119af69ae6cee3d5ae46b8afbcff3 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 1 Apr 2024 03:58:56 +0200 Subject: [PATCH 13/14] update README with yq x windows warning --- README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index eca4d45d..a4ef4708 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ macOS. The following sections show how to configure this action. -## Flutter version +## Specifying Flutter version Use specific version and channel: @@ -21,7 +21,8 @@ steps: - run: flutter --version ``` -Use version from pubspec.yaml: +Use version from pubspec.yaml (inspired by +[`actions/setup-go`](https://github.com/actions/setup-go)): ```yaml steps: @@ -35,9 +36,8 @@ steps: - run: flutter --version ``` -> [!IMPORTANT] -> For `flutter-version-file` to work, you need to have the exact Flutter version -> defined in your pubspec.yaml: +> [!IMPORTANT] For `flutter-version-file` to work, you need to have the exact +> Flutter version defined in your pubspec.yaml: > > **Good** > @@ -55,7 +55,9 @@ steps: > flutter: ">= 3.19.0 <4.0.0" > ``` -Use latest release for particular channel: +> [!WARNING] +> Using `flutter-version-file` requires [`yq`][https://github.com/mikefarah/yq], +> which is not pre-installed in `windows` images. Install it yourself. ```yaml steps: From b6150a9d644588978ac48783d01e7dbde7031cfa Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 1 Apr 2024 04:02:13 +0200 Subject: [PATCH 14/14] improve README --- README.md | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index a4ef4708..46c0efcf 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ The following sections show how to configure this action. ## Specifying Flutter version -Use specific version and channel: +### Use specific version and channel ```yaml steps: @@ -21,8 +21,9 @@ steps: - run: flutter --version ``` -Use version from pubspec.yaml (inspired by -[`actions/setup-go`](https://github.com/actions/setup-go)): +### Use version from pubspec.yaml + +This is inspired by [`actions/setup-go`](https://github.com/actions/setup-go). ```yaml steps: @@ -36,8 +37,10 @@ steps: - run: flutter --version ``` -> [!IMPORTANT] For `flutter-version-file` to work, you need to have the exact -> Flutter version defined in your pubspec.yaml: +> [!IMPORTANT] +> +> For `flutter-version-file` to work, you need to have the exact Flutter version +> defined in your pubspec.yaml: > > **Good** > @@ -56,6 +59,7 @@ steps: > ``` > [!WARNING] +> > Using `flutter-version-file` requires [`yq`][https://github.com/mikefarah/yq], > which is not pre-installed in `windows` images. Install it yourself. @@ -70,7 +74,7 @@ steps: - run: flutter --version ``` -Use latest release for particular version and/or channel: +### Use latest release for particular version and/or channel ```yaml steps: @@ -84,7 +88,7 @@ steps: - run: flutter --version ``` -Use particular version on any channel: +### Use particular version on any channel ```yaml steps: @@ -98,7 +102,7 @@ steps: - run: flutter --version ``` -Use particular git reference on master channel: +### Use particular git reference on master channel ```yaml steps: @@ -130,7 +134,11 @@ steps: - run: flutter build appbundle ``` -Build for **iOS** (macOS runners only): +### Build for iOS + +> [!NOTE] +> +> Building for iOS requires a macOS runner. ```yaml jobs: @@ -148,7 +156,7 @@ jobs: - run: flutter build ios --release --no-codesign ``` -Build for the **web**: +### Build for the web ```yaml steps: @@ -163,7 +171,7 @@ steps: - run: flutter build web ``` -Build for **Windows**: +### Build for Windows ```yaml jobs: @@ -179,7 +187,7 @@ jobs: - run: flutter build windows ``` -Build for **Linux** desktop: +### Build for Linux desktop ```yaml jobs: @@ -198,7 +206,11 @@ jobs: - run: flutter build linux ``` -Build for **macOS** desktop: +### Build for macOS desktop + +> [!NOTE] +> +> Building for macOS requires a macOS runner. ```yaml jobs: