docs: modernize README architecture with live badges, CTA buttons, an… #3
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 | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Release version tag (e.g. v1.0.0, leave empty for automated numerical version)' | |
| required: false | |
| default: '' | |
| permissions: | |
| contents: write | |
| jobs: | |
| test: | |
| name: Run Tests & Verification | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Source | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: 'go.mod' | |
| cache: true | |
| - name: Run Linters | |
| run: make lint | |
| - name: Run Tests | |
| run: make test | |
| build-and-release: | |
| name: Build & Release | |
| needs: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Source (full history) | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: 'go.mod' | |
| cache: true | |
| - name: Determine Release Tag & Time | |
| id: release_info | |
| run: | | |
| export TZ=Asia/Kolkata | |
| DISPLAY_TIME=$(date +'%d %b %Y, %H:%M IST') | |
| echo "DISPLAY_TIME=$DISPLAY_TIME" >> $GITHUB_OUTPUT | |
| BASE_VER=$(grep -m1 '^VERSION' Makefile | cut -d'=' -f2 | tr -d ' ' | sed 's/^v//') | |
| if [ -z "$BASE_VER" ]; then | |
| BASE_VER="1.0.0" | |
| fi | |
| MAJOR_MINOR=$(echo "$BASE_VER" | cut -d'.' -f1,2) | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ github.event.inputs.version }}" ]; then | |
| TAG="${{ github.event.inputs.version }}" | |
| [[ "$TAG" != v* ]] && TAG="v$TAG" | |
| elif [ "${{ github.ref_type }}" = "tag" ]; then | |
| TAG="${{ github.ref_name }}" | |
| else | |
| TAG="v${MAJOR_MINOR}.${{ github.run_number }}" | |
| fi | |
| echo "TAG=$TAG" >> $GITHUB_OUTPUT | |
| - name: Build Binaries with Makefile | |
| run: make build VERSION=${{ steps.release_info.outputs.TAG }} | |
| - name: Generate SHA256 Checksums | |
| run: | | |
| cd builds | |
| sha256sum DrivePulse-windows-x64.exe DrivePulse-linux-x64 > checksums.txt | |
| cat checksums.txt | |
| - name: Generate Structured Changelog | |
| id: changelog | |
| run: | | |
| LAST_TAG=$(git describe --tags --exclude='latest' --abbrev=0 HEAD~1 2>/dev/null || echo "") | |
| RANGE="HEAD" | |
| if [ -n "$LAST_TAG" ]; then | |
| RANGE="${LAST_TAG}..HEAD" | |
| fi | |
| FEATS=$(git log "$RANGE" --grep="^[Ff]eat" --pretty=format:"- %s ([%h](https://github.com/${{ github.repository }}/commit/%H))") | |
| FIXES=$(git log "$RANGE" --grep="^[Ff]ix" --pretty=format:"- %s ([%h](https://github.com/${{ github.repository }}/commit/%H))") | |
| CHORES=$(git log "$RANGE" --grep="^\([Cc]hore\|[Dd]ocs\|[Cc]i\|[Rr]efactor\|[Ss]tyle\|[Tt]est\)" --pretty=format:"- %s ([%h](https://github.com/${{ github.repository }}/commit/%H))") | |
| OTHERS=$(git log "$RANGE" --invert-grep --grep="^\([Ff]eat\|[Ff]ix\|[Cc]hore\|[Dd]ocs\|[Cc]i\|[Rr]efactor\|[Ss]tyle\|[Tt]est\)" --pretty=format:"- %s ([%h](https://github.com/${{ github.repository }}/commit/%H))") | |
| CL_FILE=$(mktemp) | |
| { | |
| echo "### 💡 Highlights" | |
| echo "DrivePulse automated release build (${{ steps.release_info.outputs.TAG }})." | |
| echo "" | |
| if [ -n "$FEATS" ]; then | |
| echo "### 🚀 Features & Enhancements" | |
| echo "$FEATS" | |
| echo "" | |
| fi | |
| if [ -n "$FIXES" ]; then | |
| echo "### 🐛 Bug Fixes" | |
| echo "$FIXES" | |
| echo "" | |
| fi | |
| if [ -n "$CHORES" ]; then | |
| echo "### 🧹 Maintenance & Chores" | |
| echo "$CHORES" | |
| echo "" | |
| fi | |
| if [ -n "$OTHERS" ]; then | |
| echo "### 📋 Other Commits" | |
| echo "$OTHERS" | |
| echo "" | |
| fi | |
| if [ -n "$LAST_TAG" ]; then | |
| echo "### 🔗 Full Changelog" | |
| echo "https://github.com/${{ github.repository }}/compare/${LAST_TAG}...${{ steps.release_info.outputs.TAG }}" | |
| echo "" | |
| fi | |
| } > "$CL_FILE" | |
| { | |
| echo "CHANGELOG<<EOF" | |
| cat "$CL_FILE" | |
| echo "EOF" | |
| } >> "$GITHUB_OUTPUT" | |
| rm -f "$CL_FILE" | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.release_info.outputs.TAG }} | |
| name: "DrivePulse Release #${{ github.run_number }} (${{ steps.release_info.outputs.TAG }})" | |
| body: | | |
| ⚡ **DrivePulse Automated Release** | |
| 📅 **Built at:** ${{ steps.release_info.outputs.DISPLAY_TIME }} | |
| ${{ steps.changelog.outputs.CHANGELOG }} | |
| ### 📦 Artifacts & Integrity | |
| Binary assets are attached below along with `checksums.txt` (SHA256). | |
| files: | | |
| builds/DrivePulse-windows-x64.exe | |
| builds/DrivePulse-linux-x64 | |
| builds/checksums.txt | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Update latest tag | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git tag -fa latest -m "Update latest tag to ${{ steps.release_info.outputs.TAG }}" | |
| git push origin latest --force |