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

Add dry-run (#270)

* Add dry-run

* Add dry-run test

* format

---------

Co-authored-by: Bartek Pacia <barpac02@gmail.com>
This commit is contained in:
kzrnm 2024-04-02 21:25:52 +09:00 committed by GitHub
parent 980391a6c5
commit 44ac965b96
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 39 additions and 0 deletions

View file

@ -28,6 +28,7 @@ jobs:
operating-system: operating-system:
[ubuntu-latest, windows-latest, macos-latest, macos-13, macos-14] [ubuntu-latest, windows-latest, macos-latest, macos-13, macos-14]
channel: [stable, beta, master] channel: [stable, beta, master]
dry-run: [true, false]
include: include:
- operating-system: ubuntu-latest - operating-system: ubuntu-latest
channel: main channel: main
@ -39,6 +40,7 @@ jobs:
uses: ./ uses: ./
with: with:
channel: ${{ matrix.channel }} channel: ${{ matrix.channel }}
dry-run: ${{ matrix.dry-run }}
- name: Echo outputs - name: Echo outputs
run: | run: |
echo RUNNER-OS=${{ runner.os }} echo RUNNER-OS=${{ runner.os }}
@ -51,8 +53,16 @@ jobs:
echo ARCHITECTURE=${{ steps.flutter-action.outputs.ARCHITECTURE }} echo ARCHITECTURE=${{ steps.flutter-action.outputs.ARCHITECTURE }}
shell: bash shell: bash
- run: dart --version - run: dart --version
if: ${{ matrix.dry-run != 'true' }}
shell: bash shell: bash
- run: flutter --version - 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 shell: bash
test_cache: test_cache:

View file

@ -282,6 +282,30 @@ steps:
echo PUB-CACHE-KEY=${{ steps.flutter-action.outputs.PUB-CACHE-KEY }} 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 ## Maintainers
- [Alif Rachmawadi] (original creator) - [Alif Rachmawadi] (original creator)

View file

@ -42,6 +42,10 @@ inputs:
description: Flutter pub cache path description: Flutter pub cache path
required: false required: false
default: default default: default
dry-run:
description: If true, get outputs but do not install Flutter
required: false
default: "false"
outputs: outputs:
CHANNEL: CHANNEL:
@ -108,6 +112,7 @@ runs:
- name: Run setup script - name: Run setup script
shell: bash shell: bash
if: ${{ inputs.dry-run != 'true' }}
run: | run: |
$GITHUB_ACTION_PATH/setup.sh \ $GITHUB_ACTION_PATH/setup.sh \
-n '${{ steps.flutter-action.outputs.VERSION }}' \ -n '${{ steps.flutter-action.outputs.VERSION }}' \