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 8, 2022
1 parent f95a8c9 commit 5f0ca75
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,11 @@ jobs:
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
- name: Run dart --version
shell: bash
run: dart --version
Expand Down
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,18 +146,15 @@ 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
- run: flutter --version
```
12 changes: 12 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
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 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

1 comment on commit 5f0ca75

@samandmoore
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! I think this will be really nice for consumers of this action. Thanks for doing it ❤️

Please sign in to comment.