Skip to content

Commit

Permalink
Add dry-run (#270)
Browse files Browse the repository at this point in the history
* Add dry-run

* Add dry-run test

* format

---------

Co-authored-by: Bartek Pacia <barpac02@gmail.com>
  • Loading branch information
kzrnm and bartekpacia committed Apr 2, 2024
1 parent 980391a commit 44ac965
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/workflow.yaml
Expand Up @@ -28,6 +28,7 @@ jobs:
operating-system:
[ubuntu-latest, windows-latest, macos-latest, macos-13, macos-14]
channel: [stable, beta, master]
dry-run: [true, false]
include:
- operating-system: ubuntu-latest
channel: main
Expand All @@ -39,6 +40,7 @@ jobs:
uses: ./
with:
channel: ${{ matrix.channel }}
dry-run: ${{ matrix.dry-run }}
- name: Echo outputs
run: |
echo RUNNER-OS=${{ runner.os }}
Expand All @@ -51,8 +53,16 @@ jobs:
echo ARCHITECTURE=${{ steps.flutter-action.outputs.ARCHITECTURE }}
shell: bash
- run: dart --version
if: ${{ matrix.dry-run != 'true' }}
shell: bash
- run: flutter --version
if: ${{ matrix.dry-run != 'true' }}
shell: bash
- run: "! dart --version"
if: ${{ matrix.dry-run == 'true' }}
shell: bash
- run: "! flutter --version"
if: ${{ matrix.dry-run == 'true' }}
shell: bash

test_cache:
Expand Down
24 changes: 24 additions & 0 deletions README.md
Expand Up @@ -282,6 +282,30 @@ steps:
echo PUB-CACHE-KEY=${{ steps.flutter-action.outputs.PUB-CACHE-KEY }}
```
If you don't need to install Flutter and just want the outputs, you can use the
`dry-run` option:
```yaml
steps:
- name: Clone repository
- uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
id: flutter-action
with:
channel: stable
dry-run: true
- run: |
echo CACHE-PATH=${{ steps.flutter-action.outputs.CACHE-PATH }}
echo CACHE-KEY=${{ steps.flutter-action.outputs.CACHE-KEY }}
echo CHANNEL=${{ steps.flutter-action.outputs.CHANNEL }}
echo VERSION=${{ steps.flutter-action.outputs.VERSION }}
echo ARCHITECTURE=${{ steps.flutter-action.outputs.ARCHITECTURE }}
echo PUB-CACHE-PATH=${{ steps.flutter-action.outputs.PUB-CACHE-PATH }}
echo PUB-CACHE-KEY=${{ steps.flutter-action.outputs.PUB-CACHE-KEY }}
shell: bash
```
## Maintainers
- [Alif Rachmawadi] (original creator)
Expand Down
5 changes: 5 additions & 0 deletions action.yaml
Expand Up @@ -42,6 +42,10 @@ inputs:
description: Flutter pub cache path
required: false
default: default
dry-run:
description: If true, get outputs but do not install Flutter
required: false
default: "false"

outputs:
CHANNEL:
Expand Down Expand Up @@ -108,6 +112,7 @@ runs:
- name: Run setup script
shell: bash
if: ${{ inputs.dry-run != 'true' }}
run: |
$GITHUB_ACTION_PATH/setup.sh \
-n '${{ steps.flutter-action.outputs.VERSION }}' \
Expand Down

0 comments on commit 44ac965

Please sign in to comment.