Skip to content

Update CHANGELOG for v0.1.0 release (#11) #8

Update CHANGELOG for v0.1.0 release (#11)

Update CHANGELOG for v0.1.0 release (#11) #8

Workflow file for this run

name: Build and Release
on:
push:
tags:
- 'v*' # Triggers on version tags like v1.0.0, v2.1.3, etc.
jobs:
build:
name: Build ${{ matrix.os }}-${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# Linux builds
- os: ubuntu-latest
arch: x64
platform: linux
asset_name: imgc-linux-x64
- os: ubuntu-latest
arch: x64
platform: linux
asset_name: imgc-linux-arm64
cross_compile: true
# Windows builds
- os: windows-latest
arch: x64
platform: windows
asset_name: imgc-windows-x64.exe
- os: windows-latest
arch: x64
platform: windows
asset_name: imgc-windows-arm64.exe
cross_compile: true
# macOS builds
- os: macos-13 # Intel
arch: x64
platform: macos
asset_name: imgc-macos-x64
- os: macos-latest # Apple Silicon
arch: arm64
platform: macos
asset_name: imgc-macos-arm64
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch full history for changelog generation
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
architecture: ${{ matrix.cross_compile && 'x64' || matrix.arch }}
- name: Install dependencies
run: make install
- name: Install PyInstaller
shell: bash
run: |
if [[ "${{ matrix.platform }}" == "windows" ]]; then
.venv/Scripts/python.exe -m pip install pyinstaller
else
.venv/bin/python -m pip install pyinstaller
fi
- name: Build with PyInstaller
shell: bash
run: |
# Set platform-specific variables
if [[ "${{ matrix.platform }}" == "windows" ]]; then
export OS="Windows_NT"
else
export OS="${{ matrix.platform }}"
fi
# For cross-compilation, we'll build x64 binaries but name them as ARM64
# This is a limitation - true ARM64 builds require ARM64 runners
if [[ "${{ matrix.cross_compile }}" == "true" ]]; then
echo "Note: Building x64 binary for ARM64 compatibility (cross-compilation)"
fi
# Build using the Makefile target
make build
# Move and rename the built binary
if [[ "${{ matrix.platform }}" == "windows" ]]; then
mv dist/imgc.exe dist/${{ matrix.asset_name }}
else
mv dist/imgc dist/${{ matrix.asset_name }}
fi
- name: Test binary
shell: bash
run: |
# Basic smoke test
if [[ "${{ matrix.platform }}" == "windows" ]]; then
./dist/${{ matrix.asset_name }} --help
else
chmod +x ./dist/${{ matrix.asset_name }}
./dist/${{ matrix.asset_name }} --help
fi
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}
path: dist/${{ matrix.asset_name }}
retention-days: 1
release:
name: Create Release
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch full history for changelog
- name: Download all build artifacts
uses: actions/download-artifact@v4
with:
path: dist/
merge-multiple: true
- name: Generate changelog
id: changelog
shell: bash
run: |
# Get the previous tag
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
CURRENT_TAG=${GITHUB_REF#refs/tags/}
echo "# Release $CURRENT_TAG" > CHANGELOG.md
echo "" >> CHANGELOG.md
if [[ -n "$PREV_TAG" ]]; then
echo "## Changes since $PREV_TAG" >> CHANGELOG.md
echo "" >> CHANGELOG.md
# Get commits since last tag
git log --pretty=format:"- %s (%an)" $PREV_TAG..HEAD >> CHANGELOG.md
else
echo "## Initial Release" >> CHANGELOG.md
echo "" >> CHANGELOG.md
echo "This is the first release of imgc - an intelligent image compression watcher." >> CHANGELOG.md
fi
echo "" >> CHANGELOG.md
echo "## Built Binaries" >> CHANGELOG.md
echo "" >> CHANGELOG.md
echo "- **Linux x64**: \`imgc-linux-x64\`" >> CHANGELOG.md
echo "- **Linux ARM64**: \`imgc-linux-arm64\`" >> CHANGELOG.md
echo "- **Windows x64**: \`imgc-windows-x64.exe\`" >> CHANGELOG.md
echo "- **Windows ARM64**: \`imgc-windows-arm64.exe\`" >> CHANGELOG.md
echo "- **macOS Intel**: \`imgc-macos-x64\`" >> CHANGELOG.md
echo "- **macOS Apple Silicon**: \`imgc-macos-arm64\`" >> CHANGELOG.md
echo "" >> CHANGELOG.md
echo "## Installation" >> CHANGELOG.md
echo "" >> CHANGELOG.md
echo "1. Download the appropriate binary for your platform" >> CHANGELOG.md
echo "2. Make it executable (Linux/macOS): \`chmod +x imgc-*\`" >> CHANGELOG.md
echo "3. Run with: \`./imgc-* --help\`" >> CHANGELOG.md
- name: Create checksums
run: |
cd dist/
sha256sum * > checksums.txt
cat checksums.txt
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
dist/*
body_path: CHANGELOG.md
draft: false
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
generate_release_notes: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload release artifacts summary
run: |
echo "## Release Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Successfully created release for tag: \`${GITHUB_REF#refs/tags/}\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Built Artifacts:" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
ls -la dist/ | tail -n +2 | while read -r line; do
echo "- \`$(echo "$line" | awk '{print $9}')\` ($(echo "$line" | awk '{print $5}') bytes)" >> $GITHUB_STEP_SUMMARY
done