diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index 187c4328..9f5f93c2 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -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 @@ -39,6 +40,7 @@ jobs: uses: ./ with: channel: ${{ matrix.channel }} + dry-run: ${{ matrix.dry-run }} - name: Echo outputs run: | echo RUNNER-OS=${{ runner.os }} @@ -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: diff --git a/README.md b/README.md index a54b1a5d..b49781f3 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/action.yaml b/action.yaml index 6594f64f..73774f4a 100644 --- a/action.yaml +++ b/action.yaml @@ -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: @@ -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 }}' \