From cc97e1648fff6ca5cc647fa67f47e70f7895510b Mon Sep 17 00:00:00 2001 From: Gustl22 Date: Wed, 11 Oct 2023 10:55:21 +0200 Subject: [PATCH] feat: Allow git ref as version in `master` channel (#237) * feat: Allow git ref as version in `master` channel * fix lint * fix parsing * fix test * fix checkout, add tests * replace with tab --- .github/workflows/workflow.yml | 10 ++++++++-- README.md | 12 ++++++++++++ setup.sh | 6 +++++- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index ab3cece..2e2ef3a 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -107,7 +107,13 @@ jobs: shell: bash - run: ./setup.sh -t -p dev | grep 'flutter-macos-dev-2.11.0-0.1.pre-x64-b101bfe32f634566e7cb2791a9efe19cf8828b15' shell: bash - - run: ./setup.sh -t -p master | grep 'flutter-macos-master-master-x64-master' + - run: ./setup.sh -t -p master | grep 'flutter-macos-master-any-x64-master' + shell: bash + - run: ./setup.sh -t -p -n 5b12b74 master | grep 'flutter-macos-master-5b12b74-x64-master' + shell: bash + - run: ./setup.sh -t -p -n 3.12.0-12.0.pre master | grep 'flutter-macos-master-3.12.0-12.0.pre-x64-master' + shell: bash + - run: ./setup.sh -t -p -n stable master | grep 'flutter-macos-master-stable-x64-master' shell: bash - run: ./setup.sh -t -p -n 2 any | grep 'flutter-macos-beta-2.13.0-0.4.pre-x64-25caf1461b8f643092a9f6f5b224453b5c057d10' shell: bash @@ -123,7 +129,7 @@ jobs: shell: bash - run: ./setup.sh -t -p dev | grep '/Users/runner/work/_temp/flutter/dev-2.11.0-0.1.pre-x64' shell: bash - - run: ./setup.sh -t -p master | grep '/Users/runner/work/_temp/flutter/master-master-x64' + - run: ./setup.sh -t -p master | grep '/Users/runner/work/_temp/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 diff --git a/README.md b/README.md index 99d5c54..15d18af 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,18 @@ steps: - run: flutter --version ``` +Use particular git reference on master channel: + +```yaml +steps: +- uses: actions/checkout@v3 +- uses: subosito/flutter-action@v2 + with: + flutter-version: '5b12b74' # tag, commit or branch + channel: 'master' +- run: flutter --version +``` + Build Android APK and app bundle: ```yaml diff --git a/setup.sh b/setup.sh index d28192f..272e1df 100755 --- a/setup.sh +++ b/setup.sh @@ -97,7 +97,7 @@ else fi if [[ "$CHANNEL" == "master" ]]; then - VERSION_MANIFEST="{\"channel\":\"$CHANNEL\",\"version\":\"$CHANNEL\",\"dart_sdk_arch\":\"$ARCH\",\"hash\":\"$CHANNEL\",\"sha256\":\"$CHANNEL\"}" + VERSION_MANIFEST="{\"channel\":\"$CHANNEL\",\"version\":\"$VERSION\",\"dart_sdk_arch\":\"$ARCH\",\"hash\":\"$CHANNEL\",\"sha256\":\"$CHANNEL\"}" else VERSION_MANIFEST=$(echo "$RELEASE_MANIFEST" | filter_by_channel "$CHANNEL" | filter_by_arch "$ARCH" | filter_by_version "$VERSION") fi @@ -157,6 +157,10 @@ fi if [[ ! -x "$CACHE_PATH/bin/flutter" ]]; then if [[ "$CHANNEL" == "master" ]]; then git clone -b master https://github.com/flutter/flutter.git "$CACHE_PATH" + if [[ "$VERSION" != "any" ]]; then + git config --global --add safe.directory "$CACHE_PATH" + (cd "$CACHE_PATH" && git checkout "$VERSION") + fi else archive_url=$(echo "$VERSION_MANIFEST" | jq -r '.archive') download_archive "$archive_url" "$CACHE_PATH"