Skip to content

Commit fd55f4c

Browse files
authored
Support dynamic values for PUB-CACHE-PATH (#363)
* use expand_key for PUB_CACHE_PATH * add tests * add dash * use PUB_CACHE
1 parent ca16aee commit fd55f4c

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

.github/workflows/workflow.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,10 @@ jobs:
207207
shell: bash
208208
- run: ./setup.sh -t -p -c '/tmp/flutter/:channel:-:version:-:hash:' | grep '/tmp/flutter/stable-3.7.7-2ad6cd72c040113b47ee9055e722606a490ef0da'
209209
shell: bash
210+
- run: ./setup.sh -t -p -d '/tmp/flutter/:channel:-:version:-:hash:-pub-cache-path' | grep '/tmp/flutter/stable-3.7.7-2ad6cd72c040113b47ee9055e722606a490ef0da-pub-cache-path'
211+
shell: bash
212+
- run: ./setup.sh -t -p -l '/tmp/flutter/:channel:-:version:-:hash:-pub-cache-key' | grep '/tmp/flutter/stable-3.7.7-2ad6cd72c040113b47ee9055e722606a490ef0da-pub-cache-key'
213+
shell: bash
210214

211215

212216
test_print_output_arm64:
@@ -276,3 +280,7 @@ jobs:
276280
shell: bash
277281
- run: ./setup.sh -t -p -c '/tmp/flutter/:channel:-:version:-:hash:' | grep '/tmp/flutter/stable-3.7.7-2ad6cd72c040113b47ee9055e722606a490ef0da'
278282
shell: bash
283+
- run: ./setup.sh -t -p -d '/tmp/flutter/:channel:-:version:-:hash:-pub-cache-path' | grep '/tmp/flutter/stable-3.7.7-2ad6cd72c040113b47ee9055e722606a490ef0da-pub-cache-path'
284+
shell: bash
285+
- run: ./setup.sh -t -p -l '/tmp/flutter/:channel:-:version:-:hash:-pub-cache-key' | grep '/tmp/flutter/stable-3.7.7-2ad6cd72c040113b47ee9055e722606a490ef0da-pub-cache-key'
286+
shell: bash

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ steps:
320320
# optional parameters follow
321321
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache
322322
cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path
323-
pub-cache-key: "flutter-pub:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache of dart pub get dependencies
323+
pub-cache-key: "flutter-pub-:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache of dart pub get dependencies
324324
pub-cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path
325325
- run: flutter --version
326326
```

setup.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ while getopts 'tc:k:d:l:pa:n:f:g:' flag; do
9797
exit 1
9898
fi
9999
;;
100-
g) GIT_SOURCE="$OPTARG" ;;
100+
g) GIT_SOURCE="$OPTARG" ;;
101101
?) exit 2 ;;
102102
esac
103103
done
@@ -180,6 +180,7 @@ expand_key() {
180180
CACHE_KEY=$(expand_key "$CACHE_KEY")
181181
PUB_CACHE_KEY=$(expand_key "$PUB_CACHE_KEY")
182182
CACHE_PATH=$(expand_key "$(transform_path "$CACHE_PATH")")
183+
PUB_CACHE=$(expand_key "$(transform_path "$PUB_CACHE")")
183184

184185
if [ "$PRINT_ONLY" = true ]; then
185186
version_info=$(echo "$VERSION_MANIFEST" | jq -j '.channel,":",.version,":",.dart_sdk_arch // "x64"')

0 commit comments

Comments
 (0)