For executing pipeline, it is common to get package version. One of the patrice is mark the package version in package info file.
In this example, it will use Gradle as example to show how to get package version and call it in in other steps.
Steps
- Update GitHub Action.
Add steps below in GiutHub action.- name: Read package version id: get-version run: | version=$(grep -oP "version\s*=\s*'[^']+'" build.gradle | grep -oP "[^']*" | tr -d '\n' | tr -d ' ' | tr -d 'version=') echo "::set-output name=version::${version}" - name: Print package version run: | echo "Testing current version." echo "Package version is ${{ steps.get-version.outputs.version }}"
- Check result
Execute the pipeline to check result, expect version in build.gradle mentioned will shown.
Leave a Reply