removed old workflow
This commit is contained in:
@@ -1,111 +0,0 @@
|
|||||||
name: Semantic Versioning for Tags
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types: [closed]
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
bump-version:
|
|
||||||
if: ${{ github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout Repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Check if Source Branch is docs
|
|
||||||
id: check_docs_branch
|
|
||||||
run: |
|
|
||||||
pr_head_ref="${{ github.event.pull_request.head.ref }}"
|
|
||||||
if [[ "$pr_head_ref" == "docs" ]]; then
|
|
||||||
echo "is_docs_branch=true" >> $GITHUB_ENV
|
|
||||||
echo "This is a docs branch merge. Exiting without creating a tag."
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
echo "is_docs_branch=false" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Bump Version and Tag
|
|
||||||
if: env.is_docs_branch != 'true'
|
|
||||||
id: bump_version
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
|
||||||
run: |
|
|
||||||
# Fetch the latest tags from the remote
|
|
||||||
git fetch --tags
|
|
||||||
|
|
||||||
# Get the latest tag, or initialize to v0.0.0 if no tags are found
|
|
||||||
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1` 2>/dev/null || echo "v0.0.0")
|
|
||||||
|
|
||||||
# Extract version from PR title or body
|
|
||||||
pr_body="${{ github.event.pull_request.body }}"
|
|
||||||
pr_title="${{ github.event.pull_request.title }}"
|
|
||||||
version_regex="v([0-9]+)\.([0-9]+)\.([0-9]+)"
|
|
||||||
|
|
||||||
if [[ $pr_body =~ $version_regex ]]; then
|
|
||||||
major=${BASH_REMATCH[1]}
|
|
||||||
minor=${BASH_REMATCH[2]}
|
|
||||||
patch=${BASH_REMATCH[3]}
|
|
||||||
new_tag="v$major.$minor.$patch"
|
|
||||||
elif [[ $pr_title =~ $version_regex ]]; then
|
|
||||||
major=${BASH_REMATCH[1]}
|
|
||||||
minor=${BASH_REMATCH[2]}
|
|
||||||
patch=${BASH_REMATCH[3]}
|
|
||||||
new_tag="v$major.$minor.$patch"
|
|
||||||
else
|
|
||||||
# Split the latest tag into parts
|
|
||||||
IFS='.' read -r -a parts <<< "${latest_tag#v}"
|
|
||||||
major=${parts[0]}
|
|
||||||
minor=${parts[1]}
|
|
||||||
patch=${parts[2]}
|
|
||||||
patch=$((patch + 1))
|
|
||||||
new_tag="v$major.$minor.$patch"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Bumping version from $latest_tag to $new_tag"
|
|
||||||
|
|
||||||
# Set the new tag as an environment variable
|
|
||||||
echo "new_tag=$new_tag" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
# Tag the new version
|
|
||||||
git tag $new_tag
|
|
||||||
|
|
||||||
# Configure GitHub token authentication
|
|
||||||
git remote set-url origin https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }}.git
|
|
||||||
|
|
||||||
# Push the new tag to the remote repository
|
|
||||||
git push origin $new_tag
|
|
||||||
|
|
||||||
- name: Extract Release Notes
|
|
||||||
if: env.is_docs_branch != 'true'
|
|
||||||
id: extract_notes
|
|
||||||
run: |
|
|
||||||
version="${{ env.new_tag }}"
|
|
||||||
clean_version="${version#v}"
|
|
||||||
release_notes=$(awk -v version="$clean_version" '
|
|
||||||
BEGIN { flag=0 }
|
|
||||||
# Start flagging when the version section is found
|
|
||||||
/^## \[.*\]/ {
|
|
||||||
if (flag) exit # Exit when the next section starts
|
|
||||||
}
|
|
||||||
/^## \['"$clean_version"'\]/ { flag=1; next } # Start printing after the header
|
|
||||||
flag { print } # Print lines while flag is 1
|
|
||||||
' CHANGELOG.md)
|
|
||||||
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
|
|
||||||
echo "$release_notes" >> $GITHUB_ENV
|
|
||||||
echo "EOF" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Create Release
|
|
||||||
if: env.is_docs_branch != 'true'
|
|
||||||
uses: actions/create-release@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
|
||||||
with:
|
|
||||||
tag_name: ${{ env.new_tag }}
|
|
||||||
release_name: Release ${{ env.new_tag }}
|
|
||||||
body: ${{ env.RELEASE_NOTES }}
|
|
||||||
draft: false
|
|
||||||
prerelease: false
|
|
||||||
Reference in New Issue
Block a user