feat! Dashboard & stats: Sources modal, models list, thumbnails & You… #7
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: | |
| name: Create Release on merge to main | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Bump version from PR title | |
| id: version | |
| run: | | |
| # Use PR title for conventional commit bump (feat! = major, feat = minor, fix = patch) | |
| PR_NUM=$(git log -1 --format=%B "${{ github.sha }}" | grep -oE 'Merge pull request #[0-9]+' | grep -oE '[0-9]+' | head -1) | |
| TITLE="" | |
| if [ -n "$PR_NUM" ]; then | |
| TITLE=$(gh pr view "$PR_NUM" --repo "${{ github.repository }}" --json title -q .title 2>/dev/null || true) | |
| fi | |
| if [ -z "$TITLE" ]; then | |
| # Fallback: use commit subjects from the push | |
| BEFORE="${{ github.event.before }}" | |
| AFTER="${{ github.sha }}" | |
| if [ "$BEFORE" = "0000000000000000000000000000000000000000" ]; then | |
| TITLE=$(git log -1 --format=%s 2>/dev/null) | |
| else | |
| TITLE=$(git log $BEFORE..$AFTER --format=%s 2>/dev/null | head -5) | |
| fi | |
| fi | |
| BUMP="patch" | |
| echo "$TITLE" | grep -qE '^feat!|^feat\([^)]*\)!' && BUMP="major" | |
| if [ "$BUMP" != "major" ]; then | |
| echo "$TITLE" | grep -qE '^feat(\([^)]*\))?:?' && BUMP="minor" | |
| fi | |
| if [ "$BUMP" != "major" ] && [ "$BUMP" != "minor" ]; then | |
| echo "$TITLE" | grep -qE '^fix(\([^)]*\))?:?' && BUMP="patch" | |
| fi | |
| # Use sort -V to get highest semantic version tag (more reliable than git describe in CI) | |
| LATEST=$(git tag -l 'v*' 2>/dev/null | sort -V | tail -1) | |
| if [ -z "$LATEST" ] || ! [[ "$LATEST" =~ ^v([0-9]+)\.([0-9]+)\.([0-9]+) ]]; then | |
| LATEST="v0.0.0" | |
| MAJOR=0 MINOR=0 PATCH=0 | |
| else | |
| MAJOR=${BASH_REMATCH[1]} | |
| MINOR=${BASH_REMATCH[2]} | |
| PATCH=${BASH_REMATCH[3]} | |
| fi | |
| case "$BUMP" in | |
| major) MAJOR=$((MAJOR+1)); MINOR=0; PATCH=0 ;; | |
| minor) MINOR=$((MINOR+1)); PATCH=0 ;; | |
| patch) PATCH=$((PATCH+1)) ;; | |
| esac | |
| if [ "$LATEST" = "v0.0.0" ]; then | |
| VERSION="v1.0.0" | |
| else | |
| VERSION="v${MAJOR}.${MINOR}.${PATCH}" | |
| fi | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "bump=$BUMP" >> $GITHUB_OUTPUT | |
| echo "Bumped to $VERSION ($BUMP) from $LATEST" | |
| - name: Write release body | |
| run: | | |
| BEFORE="${{ github.event.before }}" | |
| AFTER="${{ github.sha }}" | |
| PR_NUM=$(git log -1 --format=%B "$AFTER" | grep -oE 'Merge pull request #[0-9]+' | grep -oE '[0-9]+' | head -1) | |
| if [ -n "$PR_NUM" ]; then | |
| BODY=$(gh pr view "$PR_NUM" --repo "${{ github.repository }}" --json body -q .body 2>/dev/null || true) | |
| fi | |
| if [ -z "$BODY" ]; then | |
| if [ "$BEFORE" = "0000000000000000000000000000000000000000" ]; then | |
| BODY="## Changes\n\n$(git log --format='- %s' 2>/dev/null || echo 'No description.')" | |
| else | |
| BODY="## Changes\n\n$(git log $BEFORE..$AFTER --format='- %s' 2>/dev/null || echo 'No description.')" | |
| fi | |
| fi | |
| echo -e "$BODY" > release_body.md | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.version.outputs.version }} | |
| target_commitish: ${{ github.sha }} | |
| body_path: release_body.md | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |