Skip to content

Fix image building

Fix image building #5

Workflow file for this run

name: Auto Tag, Release, and Changelog
on:
push:
branches:
- main
jobs:
tag-release-changelog:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 # Получаем всю историю для генерации чейнджлога
- name: Setup Git
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
- name: Determine version bump
id: version_bump
run: |
git fetch --tags
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "Latest tag: $LATEST_TAG"
BUMP_TYPE="patch" # По умолчанию
echo "Checking commit messages for version bump type..."
for COMMIT_MESSAGE in $(git log $LATEST_TAG..HEAD --pretty=format:%s)
do
if [[ "$COMMIT_MESSAGE" == *"MAJOR"* ]]; then
BUMP_TYPE="major"
break
elif [[ "$COMMIT_MESSAGE" == *"MINOR"* ]]; then
BUMP_TYPE="minor"
fi
done
echo "Bump type determined as: $BUMP_TYPE"
echo ::set-output name=bump_type::$BUMP_TYPE
- name: Generate changelog
id: changelog
run: |
CHANGELOG=$(git log $LATEST_TAG..HEAD --pretty=format:"- %s")
if [ -z "$CHANGELOG" ]; then
echo "No new commits to add to changelog."
CHANGELOG="Minor updates."
fi
echo ::set-output name=changelog::"$CHANGELOG"
echo "Changelog: $CHANGELOG"
- name: Bump version and push tag
id: bump_and_tag
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEFAULT_BUMP: ${{ steps.version_bump.outputs.bump_type }}
RELEASE_BRANCHES: main
WITH_V: true
- name: Create GitHub release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.bump_and_tag.outputs.new_tag }}
release_name: Release ${{ steps.bump_and_tag.outputs.new_tag }}
draft: false
prerelease: false
body: ${{ steps.changelog.outputs.changelog }}