Skip to content

build: github actions check added #3

build: github actions check added

build: github actions check added #3

Workflow file for this run

name: Check Version
on:
pull_request:
branches:
- main
jobs:
check-version:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Get version
id: yq
uses: mikefarah/yq@master
with:
cmd: yq -r '.version' 'pubspec.yaml'
- name: Print version
run: echo ${{ steps.yq.outputs.result }}
- name: Get Latest Tag
id: get_tag
run: echo "::set-output name=tag::$(git describe --tags --abbrev=0)"
- name: Check Version
id: check_version
with:
env: ${{ file.path }}

Check failure on line 33 in .github/workflows/check_version.yml

View workflow run for this annotation

GitHub Actions / Check Version

Invalid workflow file

The workflow is not valid. .github/workflows/check_version.yml (Line: 33, Col: 14): Unrecognized named-value: 'file'. Located at position 1 within expression: file.path .github/workflows/check_version.yml (Line: 34, Col: 7): Unexpected value 'run'
run: |
latest_tag=${{ steps.get_tag.outputs.tag }}
provided_version=${{ steps.yq.outputs.result }}
# Extract numerical version parts from the tags
latest_version=$(echo "$latest_tag" | sed 's/v\?\([0-9.]*\)[-a-zA-Z]*$/\1/')
provided_version=$(echo "$provided_version" | sed 's/v\?\([0-9.]*\)[-a-zA-Z]*$/\1/')
echo "Latest version: $latest_version"
echo "Provided version: $provided_version"
if [[ "$provided_version" == "$latest_version" ]]; then
echo "Provided version is equal to the latest tag."
echo "::set-output name=trigger_next_action::false"
exit 1
elif [[ "$provided_version" < "$latest_version" ]]; then
echo "Provided version is lower than the latest tag."
echo "::set-output name=trigger_next_action::false"
exit 1
else
echo "Provided version is higher than the latest tag."
echo "::set-output name=trigger_next_action::true"
fi