Merge pull request #2 from tornikegomareli/feature/remove-docc #3
This file contains hidden or 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 | |
on: | |
push: | |
branches: [ "main" ] | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get latest tag | |
id: get_tag | |
run: | | |
# Get the latest tag, or set to 0.0.0 if no tags exist | |
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0") | |
echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT | |
echo "Latest tag: $LATEST_TAG" | |
- name: Calculate next version | |
id: next_version | |
run: | | |
LATEST_TAG="${{ steps.get_tag.outputs.latest_tag }}" | |
# Remove 'v' prefix if present | |
VERSION=${LATEST_TAG#v} | |
# Split version into components | |
IFS='.' read -ra VERSION_PARTS <<< "$VERSION" | |
MAJOR=${VERSION_PARTS[0]:-0} | |
MINOR=${VERSION_PARTS[1]:-0} | |
PATCH=${VERSION_PARTS[2]:-0} | |
# Increment patch version | |
PATCH=$((PATCH + 1)) | |
# Create new version | |
NEW_VERSION="$MAJOR.$MINOR.$PATCH" | |
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT | |
echo "New version: $NEW_VERSION" | |
- name: Create tag | |
run: | | |
NEW_VERSION="${{ steps.next_version.outputs.new_version }}" | |
git config user.name github-actions | |
git config user.email [email protected] | |
git tag -a "$NEW_VERSION" -m "Release version $NEW_VERSION" | |
git push origin "$NEW_VERSION" | |
- name: Create Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.next_version.outputs.new_version }} | |
release_name: Release ${{ steps.next_version.outputs.new_version }} | |
body: | | |
## Changes in this release | |
Auto-generated release for version ${{ steps.next_version.outputs.new_version }} | |
### What's Changed | |
See the [commit history](https://github.com/${{ github.repository }}/compare/${{ steps.get_tag.outputs.latest_tag }}...${{ steps.next_version.outputs.new_version }}) for a full list of changes. | |
draft: false | |
prerelease: false |