Some checks failed
Auto Tag on Merge to Main / auto-tag (push) Successful in 27s
CI - Lint and Build / lint-backend (push) Failing after 30s
CI - Lint and Build / lint-frontend (push) Failing after 2s
CI - Lint and Build / build-frontend (push) Has been skipped
CI - Lint and Build / docker-build-test (push) Has been skipped
Complete real-time train tracking system for Spanish railways (Renfe/Cercanías): - Backend API (Node.js/Express) with GTFS-RT polling workers - Frontend dashboard (React/Vite) with Leaflet maps - Real-time updates via Socket.io WebSocket - PostgreSQL/PostGIS database with Flyway migrations - Redis caching layer - Docker Compose configuration for development and production - Gitea CI/CD workflows (lint, auto-tag, release) - Production deployment with nginx + Let's Encrypt SSL 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
99 lines
2.9 KiB
YAML
99 lines
2.9 KiB
YAML
name: Auto Tag on Merge to Main
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths-ignore:
|
|
- '*.md'
|
|
- 'docs/**'
|
|
- '.gitignore'
|
|
|
|
jobs:
|
|
auto-tag:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0 # Fetch all history for proper versioning
|
|
|
|
- name: Get latest tag
|
|
id: get_tag
|
|
run: |
|
|
# Get the latest tag, default to v0.0.0 if none exists
|
|
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
|
|
echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT
|
|
echo "Latest tag: $LATEST_TAG"
|
|
|
|
- name: Determine version bump
|
|
id: bump
|
|
run: |
|
|
# Get commit messages since last tag
|
|
LATEST_TAG="${{ steps.get_tag.outputs.latest_tag }}"
|
|
|
|
# If no real tag exists (v0.0.0), get all commits
|
|
if [ "$LATEST_TAG" == "v0.0.0" ]; then
|
|
COMMITS=$(git log --pretty=format:"%s")
|
|
else
|
|
COMMITS=$(git log $LATEST_TAG..HEAD --pretty=format:"%s")
|
|
fi
|
|
|
|
# Determine version bump type based on conventional commits
|
|
BUMP_TYPE="patch"
|
|
|
|
if echo "$COMMITS" | grep -qiE "^(feat|feature)(\(.+\))?!:|^BREAKING CHANGE:"; then
|
|
BUMP_TYPE="major"
|
|
elif echo "$COMMITS" | grep -qiE "^(feat|feature)(\(.+\))?:"; then
|
|
BUMP_TYPE="minor"
|
|
elif echo "$COMMITS" | grep -qiE "^(fix|bugfix|perf|refactor)(\(.+\))?:"; then
|
|
BUMP_TYPE="patch"
|
|
fi
|
|
|
|
echo "bump_type=$BUMP_TYPE" >> $GITHUB_OUTPUT
|
|
echo "Version bump type: $BUMP_TYPE"
|
|
|
|
- name: Calculate new version
|
|
id: new_version
|
|
run: |
|
|
LATEST_TAG="${{ steps.get_tag.outputs.latest_tag }}"
|
|
BUMP_TYPE="${{ steps.bump.outputs.bump_type }}"
|
|
|
|
# Remove 'v' prefix and split version
|
|
VERSION=${LATEST_TAG#v}
|
|
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
|
|
|
|
# Bump version based on type
|
|
if [ "$BUMP_TYPE" == "major" ]; then
|
|
MAJOR=$((MAJOR + 1))
|
|
MINOR=0
|
|
PATCH=0
|
|
elif [ "$BUMP_TYPE" == "minor" ]; then
|
|
MINOR=$((MINOR + 1))
|
|
PATCH=0
|
|
else
|
|
PATCH=$((PATCH + 1))
|
|
fi
|
|
|
|
NEW_VERSION="v$MAJOR.$MINOR.$PATCH"
|
|
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
|
|
echo "New version: $NEW_VERSION"
|
|
|
|
- name: Create and push tag
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
NEW_VERSION="${{ steps.new_version.outputs.new_version }}"
|
|
|
|
# Configure git
|
|
git config user.name "Gitea Actions"
|
|
git config user.email "actions@gitea.local"
|
|
|
|
# Create annotated tag
|
|
git tag -a "$NEW_VERSION" -m "Release $NEW_VERSION"
|
|
|
|
# Push tag
|
|
git push origin "$NEW_VERSION"
|
|
|
|
echo "Created and pushed tag: $NEW_VERSION"
|