Release v0.19.0 #140
Workflow file for this run
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: version | |
on: | |
pull_request: | |
paths: | |
- "VERSION.txt" | |
jobs: | |
validate-version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out base branch | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.base.ref }} | |
- name: Get old version | |
run: | | |
old_version="$(head -1 VERSION.txt)" | |
echo "Old version: $old_version" | |
echo "old_version=$old_version" >> $GITHUB_ENV | |
- name: Check out head branch | |
uses: actions/checkout@v4 | |
- name: Get new version | |
run: | | |
new_version="$(head -1 VERSION.txt)" | |
echo "New version: $new_version" | |
echo "new_version=$new_version" >> $GITHUB_ENV | |
- name: Compare versions | |
run: dpkg --compare-versions "${{ env.old_version }}" lt "${{ env.new_version }}" | |
- name: Check stable version validity | |
if: github.event.pull_request.base.ref == 'master' | |
run: | | |
pattern=^\(0\|[1-9][0-9]*\)\.\(0\|[1-9][0-9]*\)\.\(0\|[1-9][0-9]*\)$ | |
if [[ ${{ env.new_version }} =~ $pattern ]]; then | |
echo "New version is valid."; exit 0 | |
else | |
echo "New version is invalid."; exit 1 | |
fi | |
- name: Check development version validity | |
if: github.event.pull_request.base.ref != 'master' | |
run: | | |
pattern=^\(0\|[1-9][0-9]*\)\.\(0\|[1-9][0-9]*\)dev\(0\|[1-9][0-9]*\)$ | |
if [[ ${{ env.new_version }} =~ $pattern ]]; then | |
echo "New version is valid."; exit 0 | |
else | |
echo "New version is invalid."; exit 1 | |
fi |