Fix PHP default version. #22
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
plugin_test: | |
name: asdf plugin test | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: Homebrew/actions/setup-homebrew@master | |
- uses: asdf-vm/actions/setup@v3 | |
- uses: actions/checkout@v4 | |
- name: install_plugin | |
run: mkdir -p ~/.asdf/plugins/ && cp -R "$GITHUB_WORKSPACE" ~/.asdf/plugins/php | |
- name: require_php | |
run: echo "php 8.3" > ~/.tool-versions | |
- name: install_php | |
run: asdf install php 8.3 | |
- name: test_php | |
run: | | |
required_version="8.3" && \ | |
actual_version=$(php -v | grep '(cli)' | awk '{ print $2 }' | sed 's/\.[0-9]*$//') && \ | |
if [[ "$(printf '%s\n' "$required_version" "$actual_version" | sort -V | head -n1)" != "$required_version" ]]; then \ | |
echo "PHP version $actual_version does not meet the required version $required_version" >&2 && exit 1; \ | |
else \ | |
echo "PHP version $actual_version meets the requirement"; \ | |
fi |