Replace set-output with $GITHUB_OUTPUT; fixes #192 (#194)

* replace set-output with $GITHUB_OUTPUT

* use stdout for test mode

* update readme
This commit is contained in:
Alif Rachmawadi
2022-10-13 06:31:27 +07:00
committed by GitHub
parent 1e6ee87cb8
commit dbf1fa04f4
4 changed files with 43 additions and 30 deletions

View File

@@ -28,11 +28,11 @@ jobs:
channel: ${{ matrix.channel }} channel: ${{ matrix.channel }}
- name: Echo outputs - name: Echo outputs
run: | run: |
echo cache-path=${{ steps.flutter-action.outputs.cache-path }} echo CACHE-PATH=${{ steps.flutter-action.outputs.CACHE-PATH }}
echo cache-key=${{ steps.flutter-action.outputs.cache-key }} echo CACHE-KEY=${{ steps.flutter-action.outputs.CACHE-KEY }}
echo channel=${{ steps.flutter-action.outputs.channel }} echo CHANNEL=${{ steps.flutter-action.outputs.CHANNEL }}
echo version=${{ steps.flutter-action.outputs.version }} echo VERSION=${{ steps.flutter-action.outputs.VERSION }}
echo architecture=${{ steps.flutter-action.outputs.architecture }} echo ARCHITECTURE=${{ steps.flutter-action.outputs.ARCHITECTURE }}
shell: bash shell: bash
- run: dart --version - run: dart --version
shell: bash shell: bash

View File

@@ -182,10 +182,10 @@ steps:
with: with:
channel: 'stable' channel: 'stable'
- run: | - run: |
echo cache-path=${{ steps.flutter-action.outputs.cache-path }} echo CACHE-PATH=${{ steps.flutter-action.outputs.CACHE-PATH }}
echo cache-key=${{ steps.flutter-action.outputs.cache-key }} echo CACHE-KEY=${{ steps.flutter-action.outputs.CACHE-KEY }}
echo channel=${{ steps.flutter-action.outputs.channel }} echo CHANNEL=${{ steps.flutter-action.outputs.CHANNEL }}
echo version=${{ steps.flutter-action.outputs.version }} echo VERSION=${{ steps.flutter-action.outputs.VERSION }}
echo architecture=${{ steps.flutter-action.outputs.architecture }} echo ARCHITECTURE=${{ steps.flutter-action.outputs.ARCHITECTURE }}
shell: bash shell: bash
``` ```

View File

@@ -30,16 +30,16 @@ inputs:
required: false required: false
default: '${{ runner.arch }}' default: '${{ runner.arch }}'
outputs: outputs:
cache-path: CACHE-PATH:
value: '${{ steps.flutter-action.outputs.cache-path }}' value: '${{ steps.flutter-action.outputs.CACHE-PATH }}'
cache-key: CACHE-KEY:
value: '${{ steps.flutter-action.outputs.cache-key }}' value: '${{ steps.flutter-action.outputs.CACHE-KEY }}'
channel: CHANNEL:
value: '${{ steps.flutter-action.outputs.channel }}' value: '${{ steps.flutter-action.outputs.CHANNEL }}'
version: VERSION:
value: '${{ steps.flutter-action.outputs.version }}' value: '${{ steps.flutter-action.outputs.VERSION }}'
architecture: ARCHITECTURE:
value: '${{ steps.flutter-action.outputs.architecture }}' value: '${{ steps.flutter-action.outputs.ARCHITECTURE }}'
runs: runs:
using: 'composite' using: 'composite'
steps: steps:
@@ -49,7 +49,7 @@ runs:
- if: ${{ inputs.cache == 'true' }} - if: ${{ inputs.cache == 'true' }}
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: ${{ steps.flutter-action.outputs.cache-path }} path: ${{ steps.flutter-action.outputs.CACHE-PATH }}
key: ${{ steps.flutter-action.outputs.cache-key }} 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 }} - 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 shell: bash

View File

@@ -178,17 +178,30 @@ if [[ "$PRINT_MODE" == true ]]; then
exit 1 exit 1
fi fi
echo "::set-output name=channel::$(echo "$version_info" | awk -F ':' '{print $1}')" info_channel=$(echo "$version_info" | awk -F ':' '{print $1}')
echo "::set-output name=version::$(echo "$version_info" | awk -F ':' '{print $2}')" info_version=$(echo "$version_info" | awk -F ':' '{print $2}')
echo "::set-output name=architecture::$(echo "$version_info" | awk -F ':' '{print $3}')" info_architecture=$(echo "$version_info" | awk -F ':' '{print $3}')
expanded_key=$(expand_key "$CACHE_KEY") expanded_key=$(expand_key "$CACHE_KEY")
echo "::set-output name=cache-key::$expanded_key"
cache_path=$(transform_path "$CACHE_PATH") cache_path=$(transform_path "$CACHE_PATH")
expanded_path=$(expand_key "$cache_path") expanded_path=$(expand_key "$cache_path")
echo "::set-output name=cache-path::$expanded_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=$info_channel"
echo "VERSION=$info_version"
echo "ARCHITECTURE=$info_architecture"
echo "CACHE-KEY=$expanded_key"
echo "CACHE-PATH=$expanded_path"
} >> "$GITHUB_OUTPUT"
exit 0 exit 0
fi fi