Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ca7a949e7 | ||
|
|
de04a6aaec | ||
|
|
fd55f4c5af | ||
|
|
ca16aee0c3 | ||
|
|
947e9c91a5 |
11
.github/workflows/workflow.yaml
vendored
11
.github/workflows/workflow.yaml
vendored
@@ -30,7 +30,6 @@ jobs:
|
|||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- windows-latest
|
- windows-latest
|
||||||
- macos-latest
|
- macos-latest
|
||||||
- macos-13
|
|
||||||
channel: [stable, beta, master]
|
channel: [stable, beta, master]
|
||||||
dry-run: [true, false]
|
dry-run: [true, false]
|
||||||
git-source:
|
git-source:
|
||||||
@@ -80,7 +79,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
operating-system:
|
operating-system:
|
||||||
[ubuntu-latest, windows-latest, macos-latest, macos-13]
|
[ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Clone repository
|
- name: Clone repository
|
||||||
@@ -207,6 +206,10 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
- run: ./setup.sh -t -p -c '/tmp/flutter/:channel:-:version:-:hash:' | grep '/tmp/flutter/stable-3.7.7-2ad6cd72c040113b47ee9055e722606a490ef0da'
|
- run: ./setup.sh -t -p -c '/tmp/flutter/:channel:-:version:-:hash:' | grep '/tmp/flutter/stable-3.7.7-2ad6cd72c040113b47ee9055e722606a490ef0da'
|
||||||
shell: bash
|
shell: bash
|
||||||
|
- 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'
|
||||||
|
shell: bash
|
||||||
|
- 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'
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
|
||||||
test_print_output_arm64:
|
test_print_output_arm64:
|
||||||
@@ -276,3 +279,7 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
- run: ./setup.sh -t -p -c '/tmp/flutter/:channel:-:version:-:hash:' | grep '/tmp/flutter/stable-3.7.7-2ad6cd72c040113b47ee9055e722606a490ef0da'
|
- run: ./setup.sh -t -p -c '/tmp/flutter/:channel:-:version:-:hash:' | grep '/tmp/flutter/stable-3.7.7-2ad6cd72c040113b47ee9055e722606a490ef0da'
|
||||||
shell: bash
|
shell: bash
|
||||||
|
- 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'
|
||||||
|
shell: bash
|
||||||
|
- 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'
|
||||||
|
shell: bash
|
||||||
|
|||||||
44
README.md
44
README.md
@@ -308,6 +308,11 @@ jobs:
|
|||||||
|
|
||||||
Integration with [`actions/cache`](https://github.com/actions/cache):
|
Integration with [`actions/cache`](https://github.com/actions/cache):
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> `subosito/flutter-action` now uses `actions/cache@v5` internally. If you use
|
||||||
|
> self-hosted runners, make sure they are updated to Actions Runner
|
||||||
|
> `2.327.1` or newer before enabling cache support.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- name: Clone repository
|
- name: Clone repository
|
||||||
@@ -320,7 +325,7 @@ steps:
|
|||||||
# optional parameters follow
|
# optional parameters follow
|
||||||
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache
|
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache
|
||||||
cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path
|
cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path
|
||||||
pub-cache-key: "flutter-pub:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache of dart pub get dependencies
|
pub-cache-key: "flutter-pub-:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache of dart pub get dependencies
|
||||||
pub-cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path
|
pub-cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path
|
||||||
- run: flutter --version
|
- run: flutter --version
|
||||||
```
|
```
|
||||||
@@ -335,6 +340,38 @@ dynamic values:
|
|||||||
- `:hash:`
|
- `:hash:`
|
||||||
- `:sha256:`
|
- `:sha256:`
|
||||||
|
|
||||||
|
### Using cache outputs
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> `PUB-CACHE-HIT` and `CACHE-HIT` directly use the `cache-hit` output from `actions/cache@v5`, which is the following:
|
||||||
|
> - `cache-hit` - A string value to indicate an exact match was found for the key.
|
||||||
|
> - If there's a cache hit, this will be 'true' or 'false' to indicate if there's an exact match for `key`.
|
||||||
|
> - If there's a cache miss, this will be an empty string.
|
||||||
|
|
||||||
|
Example usage (inspired by [actions/cache@v5](https://github.com/actions/cache/blob/v5/README.md#skipping-steps-based-on-cache-hit) and [#346](https://github.com/subosito/flutter-action/pull/346)) to skip `melos bootstrap` if there was a pub cache hit:
|
||||||
|
|
||||||
|
```
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Flutter
|
||||||
|
uses: subosito/flutter-action@v2
|
||||||
|
id: flutter-action
|
||||||
|
with:
|
||||||
|
channel: stable
|
||||||
|
cache: true
|
||||||
|
|
||||||
|
- name: Conditionally run melos bootstrap
|
||||||
|
if: steps.flutter-action.outputs.PUB-CACHE-HIT != 'true'
|
||||||
|
run: melos bootstrap
|
||||||
|
|
||||||
|
- name: Continue with build
|
||||||
|
run: flutter build apk
|
||||||
|
```
|
||||||
|
|
||||||
|
## Outputs
|
||||||
|
|
||||||
Use outputs from `flutter-action`:
|
Use outputs from `flutter-action`:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@@ -356,6 +393,8 @@ steps:
|
|||||||
echo ARCHITECTURE=${{ steps.flutter-action.outputs.ARCHITECTURE }}
|
echo ARCHITECTURE=${{ steps.flutter-action.outputs.ARCHITECTURE }}
|
||||||
echo PUB-CACHE-PATH=${{ steps.flutter-action.outputs.PUB-CACHE-PATH }}
|
echo PUB-CACHE-PATH=${{ steps.flutter-action.outputs.PUB-CACHE-PATH }}
|
||||||
echo PUB-CACHE-KEY=${{ steps.flutter-action.outputs.PUB-CACHE-KEY }}
|
echo PUB-CACHE-KEY=${{ steps.flutter-action.outputs.PUB-CACHE-KEY }}
|
||||||
|
echo CACHE-HIT=${{ steps.flutter-action.outputs.CACHE-HIT }}
|
||||||
|
echo PUB-CACHE-HIT=${{ steps.flutter-action.outputs.PUB-CACHE-HIT }}
|
||||||
```
|
```
|
||||||
|
|
||||||
If you don't need to install Flutter and just want the outputs, you can use the
|
If you don't need to install Flutter and just want the outputs, you can use the
|
||||||
@@ -379,7 +418,10 @@ steps:
|
|||||||
echo ARCHITECTURE=${{ steps.flutter-action.outputs.ARCHITECTURE }}
|
echo ARCHITECTURE=${{ steps.flutter-action.outputs.ARCHITECTURE }}
|
||||||
echo PUB-CACHE-PATH=${{ steps.flutter-action.outputs.PUB-CACHE-PATH }}
|
echo PUB-CACHE-PATH=${{ steps.flutter-action.outputs.PUB-CACHE-PATH }}
|
||||||
echo PUB-CACHE-KEY=${{ steps.flutter-action.outputs.PUB-CACHE-KEY }}
|
echo PUB-CACHE-KEY=${{ steps.flutter-action.outputs.PUB-CACHE-KEY }}
|
||||||
|
echo CACHE-HIT=${{ steps.flutter-action.outputs.CACHE-HIT }}
|
||||||
|
echo PUB-CACHE-HIT=${{ steps.flutter-action.outputs.PUB-CACHE-HIT }}
|
||||||
shell: bash
|
shell: bash
|
||||||
```
|
```
|
||||||
|
|
||||||
[Alif Rachmawadi]: https://github.com/subosito
|
[Alif Rachmawadi]: https://github.com/subosito
|
||||||
[Bartek Pacia]: https://github.com/bartekpacia
|
[Bartek Pacia]: https://github.com/bartekpacia
|
||||||
|
|||||||
12
action.yaml
12
action.yaml
@@ -76,6 +76,12 @@ outputs:
|
|||||||
GIT_SOURCE:
|
GIT_SOURCE:
|
||||||
value: "${{ steps.flutter-action.outputs.GIT_SOURCE }}"
|
value: "${{ steps.flutter-action.outputs.GIT_SOURCE }}"
|
||||||
description: Git source of Flutter SDK repository to clone
|
description: Git source of Flutter SDK repository to clone
|
||||||
|
CACHE-HIT:
|
||||||
|
value: "${{ steps.cache-flutter.outputs.cache-hit }}"
|
||||||
|
description: "`true` if the flutter cache was a hit"
|
||||||
|
PUB-CACHE-HIT:
|
||||||
|
value: "${{ steps.cache-pub.outputs.cache-hit }}"
|
||||||
|
description: "`true` if the pub cache was a hit"
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
@@ -109,14 +115,16 @@ runs:
|
|||||||
${{ inputs.channel }}
|
${{ inputs.channel }}
|
||||||
|
|
||||||
- name: Cache Flutter
|
- name: Cache Flutter
|
||||||
uses: actions/cache@v4
|
id: cache-flutter
|
||||||
|
uses: actions/cache@v5
|
||||||
if: ${{ inputs.cache == 'true' }}
|
if: ${{ inputs.cache == 'true' }}
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.flutter-action.outputs.CACHE-PATH }}
|
path: ${{ steps.flutter-action.outputs.CACHE-PATH }}
|
||||||
key: ${{ steps.flutter-action.outputs.CACHE-KEY }}
|
key: ${{ steps.flutter-action.outputs.CACHE-KEY }}
|
||||||
|
|
||||||
- name: Cache pub dependencies
|
- name: Cache pub dependencies
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v5
|
||||||
|
id: cache-pub
|
||||||
if: ${{ inputs.cache == 'true' }}
|
if: ${{ inputs.cache == 'true' }}
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.flutter-action.outputs.PUB-CACHE-PATH }}
|
path: ${{ steps.flutter-action.outputs.PUB-CACHE-PATH }}
|
||||||
|
|||||||
1
setup.sh
1
setup.sh
@@ -180,6 +180,7 @@ expand_key() {
|
|||||||
CACHE_KEY=$(expand_key "$CACHE_KEY")
|
CACHE_KEY=$(expand_key "$CACHE_KEY")
|
||||||
PUB_CACHE_KEY=$(expand_key "$PUB_CACHE_KEY")
|
PUB_CACHE_KEY=$(expand_key "$PUB_CACHE_KEY")
|
||||||
CACHE_PATH=$(expand_key "$(transform_path "$CACHE_PATH")")
|
CACHE_PATH=$(expand_key "$(transform_path "$CACHE_PATH")")
|
||||||
|
PUB_CACHE=$(expand_key "$(transform_path "$PUB_CACHE")")
|
||||||
|
|
||||||
if [ "$PRINT_ONLY" = true ]; then
|
if [ "$PRINT_ONLY" = true ]; then
|
||||||
version_info=$(echo "$VERSION_MANIFEST" | jq -j '.channel,":",.version,":",.dart_sdk_arch // "x64"')
|
version_info=$(echo "$VERSION_MANIFEST" | jq -j '.channel,":",.version,":",.dart_sdk_arch // "x64"')
|
||||||
|
|||||||
Reference in New Issue
Block a user