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

Set architecture options from runner's architecture (#264)

* feat: Add ARCH_NAME variable and set default ARCH value

* chore: Show runner's os and architecture

* chore: Update actions
This commit is contained in:
Koji Wakamiya 2024-02-05 11:06:33 +09:00 committed by GitHub
parent 02b923c0e1
commit 14bf5302ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 5 deletions

View file

@ -12,7 +12,7 @@ jobs:
lint_shellcheck: lint_shellcheck:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: ludeeus/action-shellcheck@master - uses: ludeeus/action-shellcheck@master
test_channel: test_channel:
runs-on: ${{ matrix.operating-system }} runs-on: ${{ matrix.operating-system }}
@ -24,13 +24,16 @@ jobs:
- operating-system: ubuntu-latest - operating-system: ubuntu-latest
channel: main channel: main
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- id: flutter-action - id: flutter-action
uses: ./ uses: ./
with: with:
channel: ${{ matrix.channel }} channel: ${{ matrix.channel }}
- name: Echo outputs - name: Echo outputs
run: | run: |
echo RUNNER-OS=${{ runner.os }}
echo RUNNER-ARCH=${{ runner.arch }}
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 }}
@ -47,7 +50,7 @@ jobs:
matrix: matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest] operating-system: [ubuntu-latest, windows-latest, macos-latest]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: ./ - uses: ./
with: with:
channel: stable channel: stable
@ -60,7 +63,7 @@ jobs:
test_print_output: test_print_output:
runs-on: macos-latest runs-on: macos-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- run: ./setup.sh -t -p | grep 'stable' - run: ./setup.sh -t -p | grep 'stable'
shell: bash shell: bash
- run: ./setup.sh -t -p | grep '3.7.7' - run: ./setup.sh -t -p | grep '3.7.7'

View file

@ -49,7 +49,7 @@ runs:
run: $GITHUB_ACTION_PATH/setup.sh -p -c '${{ inputs.cache-path }}' -k '${{ inputs.cache-key }}' -n '${{ inputs.flutter-version }}' -a '${{ inputs.architecture }}' ${{ inputs.channel }} run: $GITHUB_ACTION_PATH/setup.sh -p -c '${{ inputs.cache-path }}' -k '${{ inputs.cache-key }}' -n '${{ inputs.flutter-version }}' -a '${{ inputs.architecture }}' ${{ inputs.channel }}
shell: bash shell: bash
- if: ${{ inputs.cache == 'true' }} - if: ${{ inputs.cache == 'true' }}
uses: actions/cache@v3 uses: actions/cache@v4
with: with:
path: ${{ steps.flutter-action.outputs.CACHE-PATH }} path: ${{ steps.flutter-action.outputs.CACHE-PATH }}
key: ${{ steps.flutter-action.outputs.CACHE-KEY }}-${{ hashFiles('**/pubspec.lock') }} key: ${{ steps.flutter-action.outputs.CACHE-KEY }}-${{ hashFiles('**/pubspec.lock') }}

View file

@ -10,6 +10,7 @@ if ! check_command jq; then
fi fi
OS_NAME=$(echo "$RUNNER_OS" | awk '{print tolower($0)}') OS_NAME=$(echo "$RUNNER_OS" | awk '{print tolower($0)}')
ARCH_NAME=$(echo "$RUNNER_ARCH" | awk '{print tolower($0)}')
MANIFEST_BASE_URL="https://storage.googleapis.com/flutter_infra_release/releases" MANIFEST_BASE_URL="https://storage.googleapis.com/flutter_infra_release/releases"
MANIFEST_JSON_PATH="releases_$OS_NAME.json" MANIFEST_JSON_PATH="releases_$OS_NAME.json"
MANIFEST_URL="$MANIFEST_BASE_URL/$MANIFEST_JSON_PATH" MANIFEST_URL="$MANIFEST_BASE_URL/$MANIFEST_JSON_PATH"
@ -83,6 +84,8 @@ while getopts 'tc:k:pa:n:' flag; do
esac esac
done done
[[ -z $ARCH ]] && ARCH="$ARCH_NAME"
ARR_CHANNEL=("${@:$OPTIND:1}") ARR_CHANNEL=("${@:$OPTIND:1}")
CHANNEL="${ARR_CHANNEL[0]}" CHANNEL="${ARR_CHANNEL[0]}"