PostgreSQL backup tool with Point-In-Time-Recovery and restore verification
TypeScript backupbackupsdatabasedatabase-backupdevopsdockergolangkubernetesmariadbmongodbmysqlpgpostgrespostgresqls3self-hostedsystem-administrationtoolsweb-ui
FEATURE (versions): Add versioning
Rostislav Dugin11ae213063dd
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.ymlindex c692b280..de9803c6 100644--- a/.github/workflows/docker.yml+++ b/.github/workflows/docker.yml@@ -80,7 +80,7 @@ jobs:cd frontendnpm run lint- docker:+ build-and-push:runs-on: ubuntu-latestneeds: [lint-backend, lint-frontend]diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlnew file mode 100644index 00000000..a84d3928--- /dev/null+++ b/.github/workflows/release.yml@@ -0,0 +1,216 @@+name: Automated Release++on:+ push:+ branches: [main]+ workflow_dispatch:++jobs:+ release:+ runs-on: ubuntu-latest+ if: ${{ !contains(github.event.head_commit.message, '[skip-release]') }}++ steps:+ - name: Check out code+ uses: actions/checkout@v4+ with:+ fetch-depth: 0+ token: ${{ secrets.GITHUB_TOKEN }}++ - name: Set up Node.js+ uses: actions/setup-node@v4+ with:+ node-version: "20"++ - name: Install dependencies+ run: |+ npm install -g conventional-changelog-cli+ npm install -g semver++ - name: Get current version+ id: current_version+ run: |+ # Get the latest tag, default to 0.0.0 if no tags exist+ LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")+ echo "current_version=${LATEST_TAG#v}" >> $GITHUB_OUTPUT+ echo "Current version: ${LATEST_TAG#v}"++ - name: Analyze commits and determine version bump+ id: version_bump+ run: |+ CURRENT_VERSION="${{ steps.current_version.outputs.current_version }}"+ LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")++ # Get commits since last tag+ if [ "$LATEST_TAG" = "v0.0.0" ]; then+ COMMITS=$(git log --pretty=format:"%s" --no-merges)+ else+ COMMITS=$(git log ${LATEST_TAG}..HEAD --pretty=format:"%s" --no-merges)+ fi++ echo "Analyzing commits:"+ echo "$COMMITS"++ # Initialize flags+ HAS_FEATURE=false+ HAS_FIX=false+ HAS_BREAKING=false++ # Analyze each commit+ while IFS= read -r commit; do+ if [[ "$commit" =~ ^FEATURE ]]; then+ HAS_FEATURE=true+ echo "Found FEATURE commit: $commit"+ elif [[ "$commit" =~ ^FIX ]]; then+ HAS_FIX=true+ echo "Found FIX commit: $commit"+ elif [[ "$commit" =~ ^REFACTOR ]]; then+ HAS_FIX=true # Treat refactor as patch+ echo "Found REFACTOR commit: $commit"+ fi++ # Check for breaking changes+ if [[ "$commit" =~ BREAKING[[:space:]]CHANGE ]] || [[ "$commit" =~ "!" ]]; then+ HAS_BREAKING=true+ echo "Found BREAKING CHANGE: $commit"+ fi+ done <<< "$COMMITS"++ # Determine version bump+ if [ "$HAS_BREAKING" = true ]; then+ BUMP_TYPE="major"+ elif [ "$HAS_FEATURE" = true ]; then+ BUMP_TYPE="minor"+ elif [ "$HAS_FIX" = true ]; then+ BUMP_TYPE="patch"+ else+ BUMP_TYPE="none"+ fi++ echo "bump_type=$BUMP_TYPE" >> $GITHUB_OUTPUT++ if [ "$BUMP_TYPE" != "none" ]; then+ NEW_VERSION=$(npx semver -i $BUMP_TYPE $CURRENT_VERSION)+ echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT+ echo "should_release=true" >> $GITHUB_OUTPUT+ echo "New version will be: $NEW_VERSION"+ else+ echo "should_release=false" >> $GITHUB_OUTPUT+ echo "No version bump needed"+ fi++ - name: Generate changelog+ id: changelog+ if: steps.version_bump.outputs.should_release == 'true'+ run: |+ CURRENT_VERSION="${{ steps.current_version.outputs.current_version }}"+ NEW_VERSION="${{ steps.version_bump.outputs.new_version }}"+ LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")++ # Get commits since last tag+ if [ "$LATEST_TAG" = "v0.0.0" ]; then+ COMMITS=$(git log --pretty=format:"%s|||%H|||%an|||%ad" --date=short --no-merges)+ else+ COMMITS=$(git log ${LATEST_TAG}..HEAD --pretty=format:"%s|||%H|||%an|||%ad" --date=short --no-merges)+ fi++ # Create changelog+ CHANGELOG="# Changelog\n\n## [${NEW_VERSION}] - $(date +%Y-%m-%d)\n\n"++ # Group commits by type and area+ FEATURES=""+ FIXES=""+ REFACTORS=""++ while IFS= read -r line; do+ if [ -n "$line" ]; then+ COMMIT_MSG=$(echo "$line" | cut -d'|||' -f1)+ COMMIT_HASH=$(echo "$line" | cut -d'|||' -f2)+ COMMIT_AUTHOR=$(echo "$line" | cut -d'|||' -f3)+ COMMIT_DATE=$(echo "$line" | cut -d'|||' -f4)+ SHORT_HASH=${COMMIT_HASH:0:7}++ if [[ "$COMMIT_MSG" =~ ^FEATURE[[:space:]]*\(([^)]+)\):[[:space:]]*(.*) ]]; then+ AREA="${BASH_REMATCH[1]}"+ DESC="${BASH_REMATCH[2]}"+ FEATURES="${FEATURES}- **${AREA}**: ${DESC} ([${SHORT_HASH}](https://github.com/${{ github.repository }}/commit/${COMMIT_HASH}))\n"+ elif [[ "$COMMIT_MSG" =~ ^FIX[[:space:]]*\(([^)]+)\):[[:space:]]*(.*) ]]; then+ AREA="${BASH_REMATCH[1]}"+ DESC="${BASH_REMATCH[2]}"+ FIXES="${FIXES}- **${AREA}**: ${DESC} ([${SHORT_HASH}](https://github.com/${{ github.repository }}/commit/${COMMIT_HASH}))\n"+ elif [[ "$COMMIT_MSG" =~ ^REFACTOR[[:space:]]*\(([^)]+)\):[[:space:]]*(.*) ]]; then+ AREA="${BASH_REMATCH[1]}"+ DESC="${BASH_REMATCH[2]}"+ REFACTORS="${REFACTORS}- **${AREA}**: ${DESC} ([${SHORT_HASH}](https://github.com/${{ github.repository }}/commit/${COMMIT_HASH}))\n"+ fi+ fi+ done <<< "$COMMITS"++ # Build changelog sections+ if [ -n "$FEATURES" ]; then+ CHANGELOG="${CHANGELOG}### β¨ Features\n${FEATURES}\n"+ fi++ if [ -n "$FIXES" ]; then+ CHANGELOG="${CHANGELOG}### π Bug Fixes\n${FIXES}\n"+ fi++ if [ -n "$REFACTORS" ]; then+ CHANGELOG="${CHANGELOG}### π¨ Refactoring\n${REFACTORS}\n"+ fi++ # Save changelog to file+ echo -e "$CHANGELOG" > RELEASE_CHANGELOG.md++ # Update main CHANGELOG.md+ if [ -f "CHANGELOG.md" ]; then+ # Create new changelog content+ echo -e "$CHANGELOG" > NEW_CHANGELOG.md+ # Get existing changelog content after the [Unreleased] section+ sed -n '/## \[Unreleased\]/,$p' CHANGELOG.md | tail -n +3 >> NEW_CHANGELOG.md+ # Replace the original file+ mv NEW_CHANGELOG.md CHANGELOG.md+ else+ echo -e "$CHANGELOG" > CHANGELOG.md+ fi++ # Set output for GitHub release (escape newlines)+ {+ echo 'changelog<<EOF'+ echo -e "$CHANGELOG"+ echo EOF+ } >> $GITHUB_OUTPUT++ - name: Create Git tag+ if: steps.version_bump.outputs.should_release == 'true'+ run: |+ NEW_VERSION="${{ steps.version_bump.outputs.new_version }}"+ git config user.name "github-actions[bot]"+ git config user.email "github-actions[bot]@users.noreply.github.com"+ git tag -a "v${NEW_VERSION}" -m "Release v${NEW_VERSION}"+ git push origin "v${NEW_VERSION}"++ - name: Create GitHub Release+ if: steps.version_bump.outputs.should_release == 'true'+ uses: actions/create-release@v1+ env:+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ with:+ tag_name: v${{ steps.version_bump.outputs.new_version }}+ release_name: Release v${{ steps.version_bump.outputs.new_version }}+ body: ${{ steps.changelog.outputs.changelog }}+ draft: false+ prerelease: false++ - name: Update version files and changelog+ if: steps.version_bump.outputs.should_release == 'true'+ run: |+ NEW_VERSION="${{ steps.version_bump.outputs.new_version }}"+ cd frontend+ npm version $NEW_VERSION --no-git-tag-version+ cd ..+ git config user.name "github-actions[bot]"+ git config user.email "github-actions[bot]@users.noreply.github.com"+ git add frontend/package.json frontend/package-lock.json CHANGELOG.md+ git commit -m "chore: bump version to ${NEW_VERSION} [skip-release]" || true+ git push origin main || truediff --git a/CHANGELOG.md b/CHANGELOG.mdnew file mode 100644index 00000000..4a7c6b36--- /dev/null+++ b/CHANGELOG.md@@ -0,0 +1,10 @@+# Changelog++All notable changes to this project will be documented in this file.++The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),+and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).++## [Unreleased]++<!-- This file is automatically updated by the release workflow -->diff --git a/contribute/README.md b/contribute/README.mdindex 4fc054cf..6b3cd045 100644--- a/contribute/README.md+++ b/contribute/README.md@@ -41,6 +41,27 @@ Before any commit, make sure:3. All tests are passing4. Project is building successfully+### Automated Versioning++This project uses automated versioning based on commit messages:++- **FEATURE (area)**: Creates a **minor** version bump (e.g., 1.0.0 β 1.1.0)+- **FIX (area)**: Creates a **patch** version bump (e.g., 1.0.0 β 1.0.1)+- **REFACTOR (area)**: Creates a **patch** version bump (e.g., 1.0.0 β 1.0.1)+- **BREAKING CHANGE**: Creates a **major** version bump (e.g., 1.0.0 β 2.0.0)++The system automatically:++- Analyzes commits since the last release+- Determines the appropriate version bump+- Generates a changelog grouped by area (frontend/backend/etc.)+- Creates GitHub releases with detailed release notes+- Updates package.json version numbers++To skip automated release (for documentation updates, etc.), add `[skip-release]` to your commit message.++### Docs+If you need to add some explanation, do it in appropriate place in the code. Or in the /docs folder if it is something general. For charts, use Mermaid.### Priorities