Skip to content

⬆️ Update qodana to v2024.1.2 #9

⬆️ Update qodana to v2024.1.2

⬆️ Update qodana to v2024.1.2 #9

Workflow file for this run

name: Sync version branches with tags
on:
push:
tags:
- 'v*'
jobs:
update:
runs-on: ubuntu-latest
permissions:
actions: write
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Update version branch
run: |
TAG_REF=${{ github.ref }}
TAG_NAME=${TAG_REF:10} # Extract tag name from the ref string
BRANCH_VERSION=${TAG_NAME:0:7} # Extract version without the patch level
BRANCH_NAME="$BRANCH_VERSION"
echo "Detected tag: $TAG_NAME"
echo "Checking for existing branch: $BRANCH_NAME"
# Check if the branch exists in the remote repository
BRANCH_EXISTS=$(git ls-remote --heads origin $BRANCH_NAME)
if [[ -z "$BRANCH_EXISTS" ]]; then
echo "Creating new branch: $BRANCH_NAME"
git checkout -b $BRANCH_NAME
else
echo "Switching to existing branch: $BRANCH_NAME"
git checkout $BRANCH_NAME
fi
# Reset the branch to point at the tag's commit
echo "Resetting branch $BRANCH_NAME to commit of tag $TAG_NAME"
git reset --hard $TAG_NAME
git push -u origin $BRANCH_NAME --force