From b03c990bc5e606b805a318a116dc1d558a43d13b Mon Sep 17 00:00:00 2001 From: Alif Rachmawadi Date: Thu, 13 Oct 2022 06:02:20 +0700 Subject: [PATCH 1/3] replace set-output with $GITHUB_OUTPUT --- .github/workflows/workflow.yml | 10 +++++----- README.md | 10 +++++----- action.yml | 26 +++++++++++++------------- setup.sh | 15 ++++++++------- 4 files changed, 31 insertions(+), 30 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index fad669b4..e2ae470e 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -28,11 +28,11 @@ jobs: 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 }} + 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 diff --git a/README.md b/README.md index 211cbd51..16f8ec43 100644 --- a/README.md +++ b/README.md @@ -182,10 +182,10 @@ steps: 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 }} + 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 df659610..bb9e9057 100644 --- a/action.yml +++ b/action.yml @@ -30,16 +30,16 @@ inputs: 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 }}' + 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: @@ -49,7 +49,7 @@ runs: - if: ${{ inputs.cache == 'true' }} uses: actions/cache@v3 with: - path: ${{ steps.flutter-action.outputs.cache-path }} - key: ${{ steps.flutter-action.outputs.cache-key }} - - run: $GITHUB_ACTION_PATH/setup.sh -c '${{ steps.flutter-action.outputs.cache-path }}' -n '${{ steps.flutter-action.outputs.version }}' -a '${{ steps.flutter-action.outputs.architecture }}' ${{ steps.flutter-action.outputs.channel }} + path: ${{ steps.flutter-action.outputs.CACHE-PATH }} + key: ${{ steps.flutter-action.outputs.CACHE-KEY }} + - run: $GITHUB_ACTION_PATH/setup.sh -c '${{ steps.flutter-action.outputs.CACHE-PATH }}' -n '${{ steps.flutter-action.outputs.VERSION }}' -a '${{ steps.flutter-action.outputs.ARCHITECTURE }}' ${{ steps.flutter-action.outputs.CHANNEL }} shell: bash diff --git a/setup.sh b/setup.sh index 49b838cd..c7670194 100755 --- a/setup.sh +++ b/setup.sh @@ -178,17 +178,18 @@ if [[ "$PRINT_MODE" == true ]]; then exit 1 fi - echo "::set-output name=channel::$(echo "$version_info" | awk -F ':' '{print $1}')" - echo "::set-output name=version::$(echo "$version_info" | awk -F ':' '{print $2}')" - echo "::set-output name=architecture::$(echo "$version_info" | awk -F ':' '{print $3}')" - expanded_key=$(expand_key "$CACHE_KEY") - echo "::set-output name=cache-key::$expanded_key" - cache_path=$(transform_path "$CACHE_PATH") expanded_path=$(expand_key "$cache_path") - echo "::set-output name=cache-path::$expanded_path" + { + echo "CHANNEL=$(echo "$version_info" | awk -F ':' '{print $1}')" + echo "VERSION=$(echo "$version_info" | awk -F ':' '{print $2}')" + echo "ARCHITECTURE=$(echo "$version_info" | awk -F ':' '{print $3}')" + echo "CACHE-KEY=$expanded_key" + echo "CACHE-PATH=$expanded_path" + } >> "$GITHUB_OUTPUT" + exit 0 fi From 89e51231113c0c0a9549c5bb3331710c7e309784 Mon Sep 17 00:00:00 2001 From: Alif Rachmawadi Date: Thu, 13 Oct 2022 06:20:57 +0700 Subject: [PATCH 2/3] use stdout for test mode --- setup.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/setup.sh b/setup.sh index c7670194..7e9ebb01 100755 --- a/setup.sh +++ b/setup.sh @@ -178,14 +178,26 @@ if [[ "$PRINT_MODE" == true ]]; then exit 1 fi + info_channel=$(echo "$version_info" | awk -F ':' '{print $1}') + info_version=$(echo "$version_info" | awk -F ':' '{print $2}') + info_architecture=$(echo "$version_info" | awk -F ':' '{print $3}') expanded_key=$(expand_key "$CACHE_KEY") cache_path=$(transform_path "$CACHE_PATH") expanded_path=$(expand_key "$cache_path") + if [[ "$USE_TEST_FIXTURE" == true ]]; then + echo "CHANNEL=$info_channel" + echo "VERSION=$info_version" + echo "ARCHITECTURE=$info_architecture" + echo "CACHE-KEY=$expanded_key" + echo "CACHE-PATH=$expanded_path" + exit 0 + fi + { - echo "CHANNEL=$(echo "$version_info" | awk -F ':' '{print $1}')" - echo "VERSION=$(echo "$version_info" | awk -F ':' '{print $2}')" - echo "ARCHITECTURE=$(echo "$version_info" | awk -F ':' '{print $3}')" + echo "CHANNEL=$info_channel" + echo "VERSION=$info_version" + echo "ARCHITECTURE=$info_architecture" echo "CACHE-KEY=$expanded_key" echo "CACHE-PATH=$expanded_path" } >> "$GITHUB_OUTPUT" From 3e5f7cd83851e85e4b3a63de57db6c79e6b6de03 Mon Sep 17 00:00:00 2001 From: Alif Rachmawadi Date: Thu, 13 Oct 2022 06:24:33 +0700 Subject: [PATCH 3/3] update readme --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 16f8ec43..026cc7d8 100644 --- a/README.md +++ b/README.md @@ -182,10 +182,10 @@ steps: 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 }} + 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 ```