1.3.z - test release #156
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: "Release check" | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
paths: | |
- .github/project.yml | |
jobs: | |
check-release-version: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check release version | |
run: | | |
releases=$(curl -sSL "https://github.com/gitapi/repos/${GITHUB_REPOSITORY}/releases") | |
cat .github/project.yml | |
branch_version=$(echo "$GITHUB_BASE_REF" | cut -d. -f1,2) | |
latest_released_patch_version=$(echo "$releases" | jq -r --arg version "$branch_version" ' | |
.[] | |
| select(.tag_name | contains($version)) | |
| .tag_name' | grep -v "Beta" | head -1 | cut -d. -f3) | |
project_current_version=$(grep -E 'current-version:\s*' .github/project.yml | awk '{print $2}') | |
project_current_base=$(echo "$project_current_version" | cut -d"." -f1,2) | |
project_current_patch_version=$(echo "$project_current_version" | cut -d"." -f3,3) | |
next_release_final_tag=$(echo "$project_current_version" | cut -d"." -f4,4 || true) | |
if [[ "$next_release_final_tag" != "Final" ]]; then | |
echo "Error: \"Final\" qualifier is missing after patch version" | |
exit 1; | |
fi | |
if [[ "$project_current_base" != "$branch_version" ]]; then | |
echo "Error: major and minor versions cannot be changed, use 1.3.z" | |
exit 1; | |
fi | |
if [[ $(("$latest_released_patch_version" + 1)) != "$project_current_patch_version" ]]; then | |
echo "Error: release patch versions should be bumped one by one as sequence" | |
exit 1; | |
fi | |
project_next_version=$(grep -E 'next-version:\s*' .github/project.yml | awk '{print $2}') | |
project_next_base=$(echo "$project_next_version" | cut -d"." -f1,2) | |
project_next_patch_version=$(echo "$project_next_version" | cut -d"." -f3,3) | |
project_next_final_tag=$(echo "$project_next_version" | cut -d"." -f4,4 || true) | |
if [[ "$project_next_base" != "$project_current_base" ]] || [[ $(("$project_current_patch_version" + 1)) != "$project_next_patch_version" ]]; then | |
echo "Error: the next-version in project.yaml is not valid. Patch version of the next release must be one upper than the latest" | |
exit 1; | |
fi | |
if [[ "$project_next_final_tag" != "Final-SNAPSHOT" ]]; then | |
echo "Error: the next-version in project.yaml is not valid. \"Final-SNAPSHOT\" qualifier is missing after patch version" | |
exit 1; | |
fi |