1
0
Fork 0
mirror of https://github.com/subosito/flutter-action.git synced 2024-08-16 10:19:50 +02:00

actions/cache integration

This commit is contained in:
Alif Rachmawadi 2022-01-08 14:55:41 +00:00
parent f95a8c953b
commit 03e576dcd6
No known key found for this signature in database
GPG key ID: DD1F490C879BFA91
3 changed files with 22 additions and 11 deletions

View file

@ -72,19 +72,20 @@ jobs:
- name: Run flutter --version - name: Run flutter --version
shell: bash shell: bash
run: flutter --version run: flutter --version
test_with_cache: test_cache:
runs-on: ubuntu-latest runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ${{ runner.tool_cache }}/flutter
key: flutter-2.5.0-stable
- uses: ./ - uses: ./
with: with:
channel: stable channel: stable
flutter-version: 2.5.0 flutter-version: 2.5.0
cache: true
cache-key: key-20220110
- name: Run dart --version - name: Run dart --version
shell: bash shell: bash
run: dart --version run: dart --version

View file

@ -146,18 +146,16 @@ jobs:
- run: flutter build macos - run: flutter build macos
``` ```
Integration with actions/cache: Integration with `actions/cache`:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v2 - 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 - uses: subosito/flutter-action@v2
with: with:
channel: stable channel: stable
flutter-version: 2.5.0 flutter-version: 2.5.0
cache: true
cache-key: flutter # optional, change this to force refresh cache
- run: flutter --version - run: flutter --version
``` ```

View file

@ -12,8 +12,20 @@ inputs:
description: 'The Flutter build release channel' description: 'The Flutter build release channel'
required: false required: false
default: 'stable' default: 'stable'
cache:
description: 'Cache the Flutter SDK'
required: false
cache-key:
description: 'Identifier for the Flutter SDK cache'
required: false
default: 'flutter'
runs: runs:
using: 'composite' using: 'composite'
steps: 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 }} - run: $GITHUB_ACTION_PATH/setup.sh ${{ inputs.channel }} ${{ inputs.flutter-version }}
shell: bash shell: bash