Skip to content

Update CONTRIBUTING.md #11

Update CONTRIBUTING.md

Update CONTRIBUTING.md #11

Workflow file for this run

name: Autoversion
on:
push:
branches:
- main
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Read current version
id: read_version
run: |
CURRENT_VERSION=$(cat VERSION)
echo "Current version: $CURRENT_VERSION"
echo "::set-output name=current_version::$CURRENT_VERSION"
- name: Increment version
id: increment_version
run: |
CURRENT_VERSION=${{ steps.read_version.outputs.current_version }}
echo "Current version: $CURRENT_VERSION"
# Разбор текущей версии
if [[ $CURRENT_VERSION =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)\+(.+)$ ]]; then
major=${BASH_REMATCH[1]}
minor=${BASH_REMATCH[2]}
patch=${BASH_REMATCH[3]}
COMMIT_HASH=$(git rev-parse --short HEAD)
new_patch=$((patch + 1))
new_version="$major.$minor.$new_patch+$COMMIT_HASH"
echo "New version: $new_version"
echo "$new_version" > VERSION
echo "::set-output name=new_version::$new_version"
else
echo "Error: Version format is incorrect. Expected format is 0.0.1+hash."
exit 1
fi
- name: Create Release
id: create_release
run: |
VERSION=${{ steps.increment_version.outputs.new_version }}
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
response=$(curl -s -X POST -H "Authorization: token ${GITHUB_TOKEN}" -H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/releases \
-d "{\"tag_name\":\"$VERSION\",\"name\":\"Release $VERSION\",\"body\":\"Release version $VERSION\"}")
echo "Release response: $response"
echo "::set-output name=release_response::$response"
- name: Summarize Work
run: |
echo "Release created successfully!"
echo "Version: ${{ steps.increment_version.outputs.new_version }}"
echo "Response: ${{ steps.create_release.outputs.release_response }}"