Skip to content

group hunks under the same file together #8

group hunks under the same file together

group hunks under the same file together #8

Workflow file for this run

name: 'Build and Release'
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: write
jobs:
build:
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-22.04, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'
- name: Install dependencies (Ubuntu only)
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Install frontend dependencies
run: npm ci
- name: Build frontend
run: npm run build
- name: Get package version
id: package-version
shell: bash
run: echo "version=v$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Check if version tag exists
id: tag-exists
shell: bash
run: |
if git rev-parse "${{ steps.package-version.outputs.version }}" >/dev/null 2>&1; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Generate release notes
id: release-notes
if: github.ref == 'refs/heads/main' && steps.tag-exists.outputs.exists == 'false'
shell: bash
run: |
# Get the latest tag (if any)
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
# Generate changelog
if [ -n "$LATEST_TAG" ]; then
NOTES="## What's Changed
$(git log --pretty=format:"- %s (%h)" ${LATEST_TAG}..HEAD)
**Full Changelog**: https://github.com/${{ github.repository }}/compare/${LATEST_TAG}...${{ steps.package-version.outputs.version }}"
else
NOTES="## What's Changed
Initial release of Git Diff Viewer!
$(git log --pretty=format:"- %s (%h)")"
fi
# Set output using simpler approach
echo "notes<<EOFMARKER" >> $GITHUB_OUTPUT
echo "$NOTES" >> $GITHUB_OUTPUT
echo "EOFMARKER" >> $GITHUB_OUTPUT
- name: Build Tauri app (with release)
if: github.ref == 'refs/heads/main' && steps.tag-exists.outputs.exists == 'false'
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: ${{ steps.package-version.outputs.version }}
releaseName: 'Git Diff Viewer ${{ steps.package-version.outputs.version }}'
releaseBody: ${{ steps.release-notes.outputs.notes }}
releaseDraft: false
prerelease: false
- name: Build Tauri app (no release)
if: github.ref != 'refs/heads/main' || steps.tag-exists.outputs.exists == 'true'
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
uploadAssets: false