From de3cdb9a4b2f535dc0fa0da445a46b10b1bfefc7 Mon Sep 17 00:00:00 2001 From: Alif Rachmawadi Date: Thu, 8 Sep 2022 08:41:22 +0700 Subject: [PATCH] enhance set output --- .github/workflows/workflow.yml | 11 ++++++++++- README.md | 18 ++++++++++++++++++ action.yml | 11 +++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index d7e37c1..fad669b 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -22,9 +22,18 @@ jobs: channel: [stable, beta, master] steps: - uses: actions/checkout@v3 - - uses: ./ + - id: flutter-action + uses: ./ with: channel: ${{ matrix.channel }} + - name: Echo outputs + 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 }} + shell: bash - run: dart --version shell: bash - run: flutter --version diff --git a/README.md b/README.md index 177c31e..211cbd5 100644 --- a/README.md +++ b/README.md @@ -171,3 +171,21 @@ Note: `cache-key` and `cache-path` has support for several dynamic values: - `:arch:` - `:hash:` - `:sha256:` + +Use outputs from `flutter-action`: + +```yaml +steps: +- uses: actions/checkout@v3 +- id: flutter-action + uses: subosito/flutter-action@v2 + with: + channel: 'stable' +- 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 }} + shell: bash +``` diff --git a/action.yml b/action.yml index 756aad2..d0aa64e 100644 --- a/action.yml +++ b/action.yml @@ -29,6 +29,17 @@ inputs: description: 'The architecture of Flutter SDK executable (x64 or arm64)' required: false default: '${{ runner.arch }}' +outputs: + cache-path: + value: '${{ steps.flutter-action.outputs.cache-path }}' + cache-key: + value: '${{ steps.flutter-action.outputs.cache-key }}' + channel: + value: '${{ steps.flutter-action.outputs.channel }}' + version: + value: '${{ steps.flutter-action.outputs.version }}' + architecture: + value: '${{ steps.flutter-action.outputs.architecture }}' runs: using: 'composite' steps: