From 395322a6cded4e9ed503aebd4cc1965625f8e59a Mon Sep 17 00:00:00 2001 From: atishoo <467237923@qq.com> Date: Tue, 10 Jun 2025 15:21:26 +0800 Subject: [PATCH] use env if it existed (#360) --- README.md | 18 ++++++++++++++++++ setup.sh | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f2a1395..f0f5650 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,24 @@ steps: - run: flutter --version ``` +### Use a Flutter mirror by set ENV + +You can get more infomation from [Flutter official docs](https://docs.flutter.dev/community/china). + +```yaml +steps: + - name: Clone repository + uses: actions/checkout@v4 + - name: Set up Flutter + env: + FLUTTER_STORAGE_BASE_URL: https://storage.flutter-io.cn + uses: subosito/flutter-action@v2 + with: + channel: master + flutter-version: 5b12b74 # tag, commit or branch + - run: flutter --version +``` + ### Use alternative Flutter repository This action supports "alternative Flutters" in addition to the official diff --git a/setup.sh b/setup.sh index b9add45..c30a22b 100755 --- a/setup.sh +++ b/setup.sh @@ -12,7 +12,7 @@ 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" +MANIFEST_BASE_URL="${FLUTTER_STORAGE_BASE_URL:-https://storage.googleapis.com}/flutter_infra_release/releases" MANIFEST_JSON_PATH="releases_$OS_NAME.json" MANIFEST_URL="$MANIFEST_BASE_URL/$MANIFEST_JSON_PATH"