Compare commits

..

13 Commits

Author SHA1 Message Date
Alif Rachmawadi
b1d33bca25 print version 2022-07-25 19:47:52 +07:00
Alif Rachmawadi
e5fb13927b update readme 2022-07-25 19:36:41 +07:00
Alif Rachmawadi
ebff0a3874 tidy up 2022-07-25 19:15:22 +07:00
Alif Rachmawadi
d8cf9a8ccc tidy up 2022-07-25 18:58:09 +07:00
Alif Rachmawadi
e09ab0131a remove opencollective 2022-07-24 21:17:47 +07:00
Alif Rachmawadi
becfb71246 shellcheck linter 2022-07-24 19:30:59 +07:00
Alif Rachmawadi
54864698df test mode and cache key builder (#175) 2022-07-24 19:19:31 +07:00
Alif Rachmawadi
ea686d7c56 check jq 2022-07-19 12:00:34 +07:00
Alif Rachmawadi
9c6ea81337 check jq, fixes #170 2022-07-19 06:32:29 +07:00
Jiun Kim
29ad5bdaf4 Update for any-version on any-channel (#155)
* Update for testing any-version on any-channel

* Update `latest_version` and Add `latest_channel_version`
2022-06-05 16:06:25 +07:00
Jiun Kim
0c3f14223a Update cache-key with Runner.os and Arch (#152)
* Add `${{ runner.os }}` on cache-key

* Add `${{ inputs.architecture }}` as Cache-key
2022-04-29 09:03:21 +07:00
Jiun Kim
0f2cd3391b Update architecture default as runner.arch (#153)
* Update architecture default as `runner.arch`

* Update to convert `ARCH` as lowercase

* Refactor for `ARCH` variable
2022-04-29 07:52:26 +07:00
Jiun Kim
cf0b7b2cac Update for actions/cache version to 3 (#150) 2022-04-27 10:24:59 +07:00
8 changed files with 12545 additions and 177 deletions

1
.github/FUNDING.yml vendored
View File

@@ -1 +0,0 @@
open_collective: flutter-action

View File

@@ -4,98 +4,110 @@ on:
branches: branches:
- main - main
pull_request: pull_request:
branches: paths:
- main - setup.sh
- action.yml
jobs: jobs:
lint_shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ludeeus/action-shellcheck@master
test_channel: test_channel:
runs-on: ${{ matrix.operating-system }} runs-on: ${{ matrix.operating-system }}
strategy: strategy:
matrix: matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest] operating-system: [ubuntu-latest, windows-latest, macos-latest]
channel: [stable, beta] channel: [stable, beta, master]
steps: steps:
- name: Checkout - uses: actions/checkout@v3
uses: actions/checkout@v3
- uses: ./ - uses: ./
with: with:
channel: ${{ matrix.channel }} channel: ${{ matrix.channel }}
- name: Print FLUTTER_ROOT - run: dart --version
shell: bash shell: bash
run: echo "FLUTTER_ROOT set to $FLUTTER_ROOT" - run: flutter --version
- name: Print PUB_CACHE
shell: bash shell: bash
run: echo "PUB_CACHE set to $PUB_CACHE"
- name: Run dart --version
shell: bash
run: dart --version
- name: Run flutter --version
shell: bash
run: flutter --version
test_version:
runs-on: ubuntu-latest
strategy:
matrix:
version: [ 2.5.3, 2.x, 1, v1.12 ]
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: ./
with:
channel: stable
flutter-version: ${{ matrix.version }}
- name: Run dart --version
shell: bash
run: dart --version
- name: Run flutter --version
shell: bash
run: flutter --version
test_master_channel:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: ./
with:
channel: master
- name: Run dart --version
shell: bash
run: dart --version
- name: Run flutter --version
shell: bash
run: flutter --version
test_any_channel:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: ./
with:
channel: any
flutter-version: 2
- name: Run dart --version
shell: bash
run: dart --version
- name: Run flutter --version
shell: bash
run: flutter --version
test_cache: test_cache:
runs-on: ${{ matrix.operating-system }} runs-on: ${{ matrix.operating-system }}
strategy: strategy:
matrix: matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest] operating-system: [ubuntu-latest, windows-latest, macos-latest]
steps: steps:
- name: Checkout - uses: actions/checkout@v3
uses: actions/checkout@v3
- uses: ./ - uses: ./
with: with:
channel: stable channel: stable
flutter-version: 2.5.0
cache: true cache: true
cache-key: key-20220113 - run: dart --version
cache-path: ${{ runner.tool_cache }}/flutter/2.5.0-stable
- name: Run dart --version
shell: bash shell: bash
run: dart --version - run: flutter --version
- name: Run flutter --version shell: bash
test_version:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- run: ./setup.sh -p version | grep -x 'stable:any:x64|stable:3.0.5:x64'
shell: bash
- run: ./setup.sh -p version stable | grep -x 'stable:any:x64|stable:3.0.5:x64'
shell: bash
- run: ./setup.sh -p version beta | grep -x 'beta:any:x64|beta:3.1.0-9.0.pre:x64'
shell: bash
- run: ./setup.sh -p version master | grep -x 'master:master:x64|master:master:x64'
shell: bash
- run: ./setup.sh -p version stable 2 | grep -x 'stable:2:x64|stable:2.10.5:x64'
shell: bash
- run: ./setup.sh -p version beta 2 | grep -x 'beta:2:x64|beta:2.13.0-0.4.pre:x64'
shell: bash
- run: ./setup.sh -p version any 2 | grep -x 'any:2:x64|beta:2.13.0-0.4.pre:x64'
shell: bash
- run: ./setup.sh -p version any 3 | grep -x 'any:3:x64|stable:3.0.5:x64'
shell: bash
- run: ./setup.sh -p version any 3 arm64 | grep -x 'any:3:arm64|stable:3.0.5:arm64'
shell: bash
- run: ./setup.sh -p version stable any arm64 | grep -x 'stable:any:arm64|stable:3.0.5:arm64'
shell: bash
- run: ./setup.sh -p version stable 1 | grep -x 'stable:1:x64|stable:1.22.6:x64'
shell: bash
- run: ./setup.sh -p version stable v1 | grep -x 'stable:v1:x64|stable:v1.12.13+hotfix.9:x64'
shell: bash
- run: ./setup.sh -p version any 0 | grep -x 'any:0:x64|beta:v0.11.13:x64'
shell: bash
- run: ./setup.sh -p version any v0 | grep -x 'any:v0:x64|beta:v0.11.13:x64'
shell: bash
test_cache_key:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- run: ./setup.sh -p cache-key | grep -x 'flutter-macos-x64-stable-3.0.5-f1875d570e39de09040c8f79aa13cc56baab8db1'
shell: bash
- run: ./setup.sh -p cache-key stable | grep -x 'flutter-macos-x64-stable-3.0.5-f1875d570e39de09040c8f79aa13cc56baab8db1'
shell: bash
- run: ./setup.sh -p cache-key beta | grep -x 'flutter-macos-x64-beta-3.1.0-9.0.pre-f28e570c8cb12a004fae2d796d0d9cd46603bde9'
shell: bash
- run: ./setup.sh -p cache-key master | grep -x 'flutter-macos-x64-master-master-master'
shell: bash
- run: ./setup.sh -p cache-key stable 2 | grep -x 'flutter-macos-x64-stable-2.10.5-5464c5bac742001448fe4fc0597be939379f88ea'
shell: bash
- run: ./setup.sh -p cache-key beta 2 | grep -x 'flutter-macos-x64-beta-2.13.0-0.4.pre-25caf1461b8f643092a9f6f5b224453b5c057d10'
shell: bash
- run: ./setup.sh -p cache-key any 2 | grep -x 'flutter-macos-x64-beta-2.13.0-0.4.pre-25caf1461b8f643092a9f6f5b224453b5c057d10'
shell: bash
- run: ./setup.sh -p cache-key any 3 | grep -x 'flutter-macos-x64-stable-3.0.5-f1875d570e39de09040c8f79aa13cc56baab8db1'
shell: bash
- run: ./setup.sh -p cache-key any 3 arm64 | grep -x 'flutter-macos-arm64-stable-3.0.5-f1875d570e39de09040c8f79aa13cc56baab8db1'
shell: bash
- run: ./setup.sh -p cache-key stable any arm64 | grep -x 'flutter-macos-arm64-stable-3.0.5-f1875d570e39de09040c8f79aa13cc56baab8db1'
shell: bash
- run: ./setup.sh -p cache-key stable 1 | grep -x 'flutter-macos-x64-stable-1.22.6-9b2d32b605630f28625709ebd9d78ab3016b2bf6'
shell: bash
- run: ./setup.sh -p cache-key stable v1 | grep -x 'flutter-macos-x64-stable-v1.12.13+hotfix.9-f139b11009aeb8ed2a3a3aa8b0066e482709dde3'
shell: bash
- run: ./setup.sh -p cache-key any 0 | grep -x 'flutter-macos-x64-beta-v0.11.13-58c8489fcdb4e4ef6c010117584c9b23d15221aa'
shell: bash
- run: ./setup.sh -p cache-key any v0 | grep -x 'flutter-macos-x64-beta-v0.11.13-58c8489fcdb4e4ef6c010117584c9b23d15221aa'
shell: bash
- run: ./setup.sh -p cache-key -k 'custom-:channel:-:version:-:hash:' | grep -x 'custom-stable-3.0.5-f1875d570e39de09040c8f79aa13cc56baab8db1'
shell: bash
- run: ./setup.sh -p cache-key -k 'custom-:channel:-:version:-:sha256:' | grep -x 'custom-stable-3.0.5-e79a04dcfd1b583e5831433fc200800ba0d1e9fe4567cb661479bd2542d4c685'
shell: bash shell: bash
run: flutter --version

View File

@@ -11,7 +11,7 @@ steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: subosito/flutter-action@v2 - uses: subosito/flutter-action@v2
with: with:
flutter-version: '2.8.0' flutter-version: '3.0.5'
channel: 'stable' channel: 'stable'
- run: flutter --version - run: flutter --version
``` ```
@@ -62,7 +62,7 @@ steps:
java-version: '11' java-version: '11'
- uses: subosito/flutter-action@v2 - uses: subosito/flutter-action@v2
with: with:
flutter-version: '2.10.4' flutter-version: '3.0.5'
- run: flutter pub get - run: flutter pub get
- run: flutter test - run: flutter test
- run: flutter build apk - run: flutter build apk
@@ -79,7 +79,7 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: subosito/flutter-action@v2 - uses: subosito/flutter-action@v2
with: with:
flutter-version: '2.10.4' channel: 'stable'
architecture: x64 architecture: x64
- run: flutter pub get - run: flutter pub get
- run: flutter test - run: flutter test
@@ -93,7 +93,7 @@ steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: subosito/flutter-action@v2 - uses: subosito/flutter-action@v2
with: with:
flutter-version: '2.10.4' channel: 'stable'
- run: flutter pub get - run: flutter pub get
- run: flutter test - run: flutter test
- run: flutter build web - run: flutter build web
@@ -124,7 +124,7 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: subosito/flutter-action@v2 - uses: subosito/flutter-action@v2
with: with:
channel: 'beta' channel: 'stable'
- run: | - run: |
sudo apt-get update -y sudo apt-get update -y
sudo apt-get install -y ninja-build libgtk-3-dev sudo apt-get install -y ninja-build libgtk-3-dev
@@ -142,7 +142,7 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: subosito/flutter-action@v2 - uses: subosito/flutter-action@v2
with: with:
channel: 'beta' channel: 'stable'
architecture: x64 architecture: x64
- run: flutter config --enable-macos-desktop - run: flutter config --enable-macos-desktop
- run: flutter build macos - run: flutter build macos
@@ -155,11 +155,19 @@ steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: subosito/flutter-action@v2 - uses: subosito/flutter-action@v2
with: with:
flutter-version: '2.10.x'
channel: 'stable' channel: 'stable'
cache: true cache: true
cache-key: flutter # optional, change this to force refresh cache cache-key: 'flutter-:os:-:arch:-:channel:-:version:-:hash:' # optional, change this to force refresh cache
cache-path: ${{ runner.tool_cache }}/flutter # optional, change this to specify the cache path cache-path: ${{ runner.tool_cache }}/flutter # optional, change this to specify the cache path
architecture: x64 # optional, x64 or arm64 architecture: x64 # optional, x64 or arm64
- run: flutter --version - run: flutter --version
``` ```
Note: `cache-key` has support for several dynamic values:
- `:os:`
- `:arch:`
- `:channel:`
- `:version:`
- `:hash:`
- `:sha256:`

View File

@@ -19,7 +19,7 @@ inputs:
cache-key: cache-key:
description: 'Identifier for the Flutter SDK cache' description: 'Identifier for the Flutter SDK cache'
required: false required: false
default: 'flutter' default: 'flutter-:os:-:arch:-:channel:-:version:-:hash:'
cache-path: cache-path:
description: 'Flutter SDK cache path' description: 'Flutter SDK cache path'
required: false required: false
@@ -27,14 +27,18 @@ inputs:
architecture: architecture:
description: 'The architecture of Flutter SDK executable (x64 or arm64)' description: 'The architecture of Flutter SDK executable (x64 or arm64)'
required: false required: false
default: 'x64' default: ${{ runner.arch }}
runs: runs:
using: 'composite' using: 'composite'
steps: steps:
- if: ${{ inputs.cache == 'true' }} - if: ${{ inputs.cache == 'true' }}
uses: actions/cache@v2 id: flutter-action-cache-key-builder
run: echo "::set-output name=cache-key::$($GITHUB_ACTION_PATH/setup.sh -p cache-key -k ${{ inputs.cache-key }} ${{ inputs.channel }} ${{ inputs.flutter-version }} ${{ inputs.architecture }})"
shell: bash
- if: ${{ inputs.cache == 'true' }}
uses: actions/cache@v3
with: with:
path: ${{ inputs.cache-path }} path: ${{ inputs.cache-path }}
key: ${{ inputs.cache-key }}-${{ inputs.channel }}-${{ inputs.flutter-version }} key: ${{ steps.flutter-action-cache-key-builder.outputs.cache-key }}
- run: $GITHUB_ACTION_PATH/setup.sh -c "${{ inputs.cache-path }}" ${{ inputs.channel }} ${{ inputs.flutter-version }} ${{ inputs.architecture }} - run: $GITHUB_ACTION_PATH/setup.sh -c "${{ inputs.cache-path }}" ${{ inputs.channel }} ${{ inputs.flutter-version }} ${{ inputs.architecture }}
shell: bash shell: bash

297
setup.sh
View File

@@ -1,122 +1,233 @@
#!/bin/bash #!/bin/bash
check_command() {
command -v "$1" >/dev/null 2>&1
}
if ! check_command jq; then
echo "jq not found, please install it, https://stedolan.github.io/jq/download/"
exit 1
fi
OS_NAME=$(echo "$RUNNER_OS" | awk '{print tolower($0)}') OS_NAME=$(echo "$RUNNER_OS" | awk '{print tolower($0)}')
MANIFEST_BASE_URL="https://storage.googleapis.com/flutter_infra_release/releases" MANIFEST_BASE_URL="https://storage.googleapis.com/flutter_infra_release/releases"
MANIFEST_URL="${MANIFEST_BASE_URL}/releases_${OS_NAME}.json" MANIFEST_URL="$MANIFEST_BASE_URL/releases_$OS_NAME.json"
MANIFEST_TEST_FIXTURE="test/releases_$OS_NAME.json"
# convert version like 2.5.x to 2.5 legacy_wildcard_version() {
normalize_version() { if [[ $1 == any ]]; then
if [[ $1 == *x ]]; then jq --arg version "$2" '.releases | map(select(.version | startswith($version) )) | first'
echo ${1::-2} else
else jq --arg channel "$1" --arg version "$2" '.releases | map(select(.channel==$channel) | select(.version | startswith($version) )) | first'
echo $1 fi
fi
}
latest_version() {
jq --arg channel "$1" --arg arch "$ARCH" '.releases | map(select(.channel==$channel) | select(.dart_sdk_arch == null or .dart_sdk_arch == $arch)) | first'
} }
wildcard_version() { wildcard_version() {
if [ $2 == *"v"* ]; then # is legacy version format if [[ $1 == any ]]; then
if [[ $1 == any ]]; then jq --arg version "$2" --arg arch "$3" '.releases | map(select(.version | startswith($version)) | select(.dart_sdk_arch == null or .dart_sdk_arch == $arch)) | first'
jq --arg version "$2" '.releases | map(select(.version | startswith($version) )) | first' else
else jq --arg channel "$1" --arg version "$2" --arg arch "$3" '.releases | map(select(.channel==$channel) | select(.version | startswith($version) ) | select(.dart_sdk_arch == null or .dart_sdk_arch == $arch)) | first'
jq --arg channel "$1" --arg version "$2" '.releases | map(select(.channel==$channel) | select(.version | startswith($version) )) | first' fi
fi
elif [[ $1 == any ]]; then
jq --arg version "$2" --arg arch "$ARCH" '.releases | map(select(.version | startswith($version)) | select(.dart_sdk_arch == null or .dart_sdk_arch == $arch)) | first'
else
jq --arg channel "$1" --arg version "$2" --arg arch "$ARCH" '.releases | map(select(.channel==$channel) | select(.version | startswith($version) ) | select(.dart_sdk_arch == null or .dart_sdk_arch == $arch)) | first'
fi
} }
get_version() { get_version() {
if [[ $2 == any ]]; then if [[ "$1" == any && "$2" == any ]]; then # latest_version
latest_version $1 jq --arg arch "$3" '.releases | map(select(.dart_sdk_arch == null or .dart_sdk_arch == $arch)) | first'
else elif [[ "$2" == any ]]; then # latest channel version
wildcard_version $1 $2 jq --arg channel "$1" --arg arch "$3" '.releases | map(select(.channel==$channel) | select(.dart_sdk_arch == null or .dart_sdk_arch == $arch)) | first'
fi else
wildcard_version "$1" "$2" "$3"
fi
} }
get_version_manifest() { normalize_version() {
releases_manifest=$(curl --silent --connect-timeout 15 --retry 5 $MANIFEST_URL) if [[ "$1" == *.x ]]; then
version_manifest=$(echo $releases_manifest | get_version $1 $(normalize_version $2)) echo "${1/.x/}"
else
if [[ $version_manifest == null ]]; then echo "$1"
# fallback through legacy version format fi
echo $releases_manifest | wildcard_version $1 "v$(normalize_version $2)"
else
echo $version_manifest
fi
} }
download_archive() { not_found_error() {
archive_url="$MANIFEST_BASE_URL/$1" echo "Unable to determine Flutter version for channel: $1 version: $2 architecture: $3"
archive_name=$(basename $1)
archive_local="$RUNNER_TEMP/$archive_name"
curl --connect-timeout 15 --retry 5 $archive_url >$archive_local
# Create the target folder
mkdir -p "$2"
if [[ $archive_name == *zip ]]; then
unzip -q -o "$archive_local" -d "$RUNNER_TEMP"
# Remove the folder again so that the move command can do a simple rename
# instead of moving the content into the target folder.
# This is a little bit of a hack since the "mv --no-target-directory"
# linux option is not available here
rm -r "$2"
mv ${RUNNER_TEMP}/flutter "$2"
else
tar xf "$archive_local" -C "$2" --strip-components=1
fi
rm $archive_local
} }
transform_path() { transform_path() {
if [[ $OS_NAME == windows ]]; then if [[ "$OS_NAME" == windows ]]; then
echo $1 | sed -e 's/^\///' -e 's/\//\\/g' echo "$1" | sed -e 's/^\///' -e 's/\//\\/g'
else else
echo $1 echo "$1"
fi fi
}
download_archive() {
archive_url="$MANIFEST_BASE_URL/$1"
archive_name=$(basename "$1")
archive_local="$RUNNER_TEMP/$archive_name"
curl --connect-timeout 15 --retry 5 "$archive_url" >"$archive_local"
# Create the target folder
mkdir -p "$2"
if [[ "$archive_name" == *zip ]]; then
unzip -q -o "$archive_local" -d "$RUNNER_TEMP"
# Remove the folder again so that the move command can do a simple rename
# instead of moving the content into the target folder.
# This is a little bit of a hack since the "mv --no-target-directory"
# linux option is not available here
rm -r "$2"
mv "$RUNNER_TEMP"/flutter "$2"
else
tar xf "$archive_local" -C "$2" --strip-components=1
fi
rm "$archive_local"
} }
CACHE_PATH="" CACHE_PATH=""
CACHE_KEY=""
PRINT_MODE=""
while getopts 'c:' flag; do while getopts 'c:k:p:' flag; do
case "${flag}" in case "$flag" in
c) CACHE_PATH="$OPTARG" ;; c) CACHE_PATH="$OPTARG" ;;
?) exit 2 ;; k) CACHE_KEY="$OPTARG" ;;
esac p) PRINT_MODE="$OPTARG" ;;
?) exit 2 ;;
esac
done done
CHANNEL="${@:$OPTIND:1}" ARR_CHANNEL=("${@:$OPTIND:1}")
VERSION="${@:$OPTIND+1:1}" ARR_VERSION=("${@:$OPTIND+1:1}")
ARCH="${@:$OPTIND+2:1}" ARR_ARCH=("${@:$OPTIND+2:1}")
SDK_CACHE="$(transform_path ${CACHE_PATH})" CHANNEL="${ARR_CHANNEL[0]}"
PUB_CACHE="$(transform_path ${CACHE_PATH}/.pub-cache)" VERSION="${ARR_VERSION[0]}"
ARCH=$(echo "${ARR_ARCH[0]}" | awk '{print tolower($0)}')
if [[ ! -x "${SDK_CACHE}/bin/flutter" ]]; then [[ -z $CHANNEL ]] && CHANNEL=stable
if [[ $CHANNEL == master ]]; then [[ -z $VERSION ]] && VERSION=any
git clone -b master https://github.com/flutter/flutter.git "$SDK_CACHE" [[ -z $ARCH ]] && ARCH=x64
else [[ -z $CACHE_PATH ]] && CACHE_PATH=/tmp
VERSION_MANIFEST=$(get_version_manifest $CHANNEL $VERSION) [[ -z $CACHE_KEY ]] && CACHE_KEY="flutter-:os:-:arch:-:channel:-:version:-:hash:"
if [[ $VERSION_MANIFEST == null ]]; then
echo "Unable to determine Flutter version for channel: $CHANNEL version: $VERSION architecture: $ARCH" RELEASE_MANIFEST=""
exit 1 VERSION_MANIFEST=""
fi
ARCHIVE_PATH=$(echo $VERSION_MANIFEST | jq -r '.archive') get_version_manifest() {
download_archive "$ARCHIVE_PATH" "$SDK_CACHE" version_normalized=$(normalize_version "$VERSION")
fi version_manifest=$(echo "$RELEASE_MANIFEST" | get_version "$CHANNEL" "$version_normalized" "$ARCH")
if [[ "$version_manifest" == null ]]; then
version_manifest=$(echo "$RELEASE_MANIFEST" | legacy_wildcard_version "$CHANNEL" "v$version_normalized")
fi
version_arch=$(echo "$version_manifest" | jq -r '.dart_sdk_arch')
if [[ "$version_arch" == null ]]; then
if [[ "$ARCH" == x64 ]]; then
echo "$version_manifest" | jq --arg dart_sdk_arch x64 '.+={dart_sdk_arch:$dart_sdk_arch}'
else
echo ""
fi
else
echo "$version_manifest"
fi
}
expand_key() {
version_channel=$(echo "$VERSION_MANIFEST" | jq -r '.channel')
version_version=$(echo "$VERSION_MANIFEST" | jq -r '.version')
version_arch=$(echo "$VERSION_MANIFEST" | jq -r '.dart_sdk_arch')
version_hash=$(echo "$VERSION_MANIFEST" | jq -r '.hash')
version_sha_256=$(echo "$VERSION_MANIFEST" | jq -r '.sha256')
expanded_key="${1/:channel:/$version_channel}"
expanded_key="${expanded_key/:version:/$version_version}"
expanded_key="${expanded_key/:arch:/$version_arch}"
expanded_key="${expanded_key/:hash:/$version_hash}"
expanded_key="${expanded_key/:sha256:/$version_sha_256}"
expanded_key="${expanded_key/:os:/$OS_NAME}"
echo "$expanded_key"
}
print_version() {
version_debug=$(echo "$VERSION_MANIFEST" | jq -j '.channel,":",.version,":",.dart_sdk_arch')
echo "$CHANNEL:$VERSION:$ARCH|$version_debug"
}
if [[ -n "$PRINT_MODE" ]]; then
if [[ "$CHANNEL" == master ]]; then
if [[ "$PRINT_MODE" == version ]]; then
echo "master:master:$ARCH|master:master:$ARCH"
exit 0
fi
if [[ "$PRINT_MODE" == cache-key ]]; then
VERSION_MANIFEST="{\"channel\":\"$CHANNEL\",\"version\":\"$CHANNEL\",\"dart_sdk_arch\":\"$ARCH\",\"hash\":\"$CHANNEL\",\"sha256\":\"$CHANNEL\"}"
EXPANDED_KEY=$(expand_key "$CACHE_KEY")
echo "$EXPANDED_KEY"
exit 0
fi
exit 1
fi
RELEASE_MANIFEST=$(cat "$MANIFEST_TEST_FIXTURE")
VERSION_MANIFEST=$(get_version_manifest)
if [[ -z "$VERSION_MANIFEST" ]]; then
not_found_error "$CHANNEL" "$VERSION" "$ARCH"
exit 1
fi
if [[ "$PRINT_MODE" == version ]]; then
print_version
exit 0
fi
if [[ "$PRINT_MODE" == cache-key ]]; then
EXPANDED_KEY=$(expand_key "$CACHE_KEY")
echo "$EXPANDED_KEY"
exit 0
fi
exit 1
fi fi
echo "FLUTTER_ROOT=${SDK_CACHE}" >>$GITHUB_ENV CACHE_PATH=$(transform_path "$CACHE_PATH")
echo "PUB_CACHE=${PUB_CACHE}" >>$GITHUB_ENV SDK_CACHE=$(expand_key "$CACHE_PATH")
PUB_CACHE=$(expand_key "$SDK_CACHE/.pub-cache")
echo "${SDK_CACHE}/bin" >>$GITHUB_PATH if [[ ! -x "$SDK_CACHE/bin/flutter" ]]; then
echo "${SDK_CACHE}/bin/cache/dart-sdk/bin" >>$GITHUB_PATH if [[ $CHANNEL == master ]]; then
echo "${PUB_CACHE}/bin" >>$GITHUB_PATH git clone -b master https://github.com/flutter/flutter.git "$SDK_CACHE"
else
RELEASE_MANIFEST=$(curl --silent --connect-timeout 15 --retry 5 "$MANIFEST_URL")
VERSION_MANIFEST=$(get_version_manifest)
if [[ -z "$VERSION_MANIFEST" ]]; then
not_found_error "$CHANNEL" "$VERSION" "$ARCH"
exit 1
fi
ARCHIVE_PATH=$(echo "$VERSION_MANIFEST" | jq -r '.archive')
download_archive "$ARCHIVE_PATH" "$SDK_CACHE"
print_version
fi
fi
{
echo "FLUTTER_ROOT=$SDK_CACHE"
echo "PUB_CACHE=$PUB_CACHE"
} >>"$GITHUB_ENV"
{
echo "$SDK_CACHE/bin"
echo "$SDK_CACHE/bin/cache/dart-sdk/bin"
echo "$PUB_CACHE/bin"
} >>"$GITHUB_PATH"

4034
test/releases_linux.json Normal file

File diff suppressed because it is too large Load Diff

4166
test/releases_macos.json Normal file

File diff suppressed because it is too large Load Diff

4034
test/releases_windows.json Normal file

File diff suppressed because it is too large Load Diff