Skip to content

Commit

Permalink
actions/cache integration
Browse files Browse the repository at this point in the history
  • Loading branch information
subosito committed Jan 10, 2022
1 parent f95a8c9 commit 03e576d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/workflow.yml
Expand Up @@ -72,19 +72,20 @@ jobs:
- name: Run flutter --version
shell: bash
run: flutter --version
test_with_cache:
runs-on: ubuntu-latest
test_cache:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ${{ runner.tool_cache }}/flutter
key: flutter-2.5.0-stable
- uses: ./
with:
channel: stable
flutter-version: 2.5.0
cache: true
cache-key: key-20220110
- name: Run dart --version
shell: bash
run: dart --version
Expand Down
8 changes: 3 additions & 5 deletions README.md
Expand Up @@ -146,18 +146,16 @@ jobs:
- run: flutter build macos
```

Integration with actions/cache:
Integration with `actions/cache`:

```yaml
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ${{ runner.tool_cache }}/flutter
key: flutter-2.5.0-stable
- uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 2.5.0
cache: true
cache-key: flutter # optional, change this to force refresh cache
- run: flutter --version
```
12 changes: 12 additions & 0 deletions action.yml
Expand Up @@ -12,8 +12,20 @@ inputs:
description: 'The Flutter build release channel'
required: false
default: 'stable'
cache:
description: 'Cache the Flutter SDK'
required: false
cache-key:
description: 'Identifier for the Flutter SDK cache'
required: false
default: 'flutter'
runs:
using: 'composite'
steps:
- if: ${{ inputs.cache == 'true' }}
uses: actions/cache@v2
with:
path: ${{ runner.tool_cache }}/flutter
key: ${{ inputs.cache-key }}-${{ inputs.channel }}-${{ inputs.flutter-version }}
- run: $GITHUB_ACTION_PATH/setup.sh ${{ inputs.channel }} ${{ inputs.flutter-version }}
shell: bash

0 comments on commit 03e576d

Please sign in to comment.