Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
194 changes: 194 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
name: Create Release

on:
push:
tags:
- 'v[0-9]+\.[0-9]+\.[0-9]+'
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 0.2.9)'
required: true
type: string
create_tag:
description: 'Create and push git tag'
required: false
type: boolean
default: true

env:
CARGO_TERM_COLOR: always

jobs:
create-release:
runs-on: ubuntu-latest
permissions:
contents: write # Required for creating releases and tags

outputs:
version: ${{ steps.get_version.outputs.version }}
tag_name: ${{ steps.get_version.outputs.TAG_NAME }}

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for changelog generation

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y cmake libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libx11-dev libxext-dev

- name: Get version
id: get_version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ inputs.version }}"
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "TAG_NAME=v$VERSION" >> $GITHUB_OUTPUT
echo "Manual release for version: $VERSION"
else
TAG_NAME=${GITHUB_REF#refs/tags/}
VERSION=${TAG_NAME#v}
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_OUTPUT
echo "Tag-triggered release: $TAG_NAME"
fi

- name: Verify Cargo.toml version matches
run: |
CARGO_VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name == "rust-animation") | .version')
RELEASE_VERSION="${{ steps.get_version.outputs.VERSION }}"
echo "Cargo.toml version: $CARGO_VERSION"
echo "Release version: $RELEASE_VERSION"
if [ "$CARGO_VERSION" != "$RELEASE_VERSION" ]; then
echo "::error::Version mismatch! Cargo.toml has $CARGO_VERSION but release version is $RELEASE_VERSION"
echo "Please update Cargo.toml version to $RELEASE_VERSION before creating a release"
exit 1
fi

- name: Create and push tag (manual trigger only)
if: github.event_name == 'workflow_dispatch' && inputs.create_tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "${{ steps.get_version.outputs.TAG_NAME }}" -m "Release ${{ steps.get_version.outputs.TAG_NAME }}"
git push origin "${{ steps.get_version.outputs.TAG_NAME }}"

- name: Run tests
run: cargo test --lib --verbose

- name: Build
run: cargo build --release --verbose

- name: Generate release notes
id: release_notes
run: |
# Extract changelog for this version
VERSION="${{ steps.get_version.outputs.VERSION }}"

# Try to extract from CHANGELOG.md
if [ -f CHANGELOG.md ]; then
# Extract section for this version
NOTES=$(sed -n "/## \[$VERSION\]/,/## \[/p" CHANGELOG.md | sed '$d' | tail -n +2)

if [ -z "$NOTES" ]; then
echo "No specific changelog entry found for version $VERSION"
cat > release_notes.txt << ENDOFNOTES
Release version $VERSION

See [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md) for details.
ENDOFNOTES
else
echo "$NOTES" > release_notes.txt
fi
else
# Generate basic release notes from recent commits
echo "Release version $VERSION" > release_notes.txt
echo "" >> release_notes.txt
echo "## Changes in this release" >> release_notes.txt
echo "" >> release_notes.txt
git log --pretty=format:"- %s" $(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || git rev-list --max-parents=0 HEAD)..HEAD 2>/dev/null >> release_notes.txt || git log --pretty=format:"- %s" -10 >> release_notes.txt
echo "" >> release_notes.txt
echo "---" >> release_notes.txt
echo "*See full changelog at [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md)*" >> release_notes.txt
fi

echo "Generated release notes"

- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.get_version.outputs.TAG_NAME }}
name: Release ${{ steps.get_version.outputs.TAG_NAME }}
body_path: release_notes.txt
draft: false
prerelease: false
generate_release_notes: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
run: cargo publish

build-examples:
needs: create-release
runs-on: ${{ matrix.os }}
permissions:
contents: write
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
include:
- os: ubuntu-latest
artifact_name: rust-animation-examples-linux
build_deps: sudo apt-get update && sudo apt-get install -y cmake libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libx11-dev libxext-dev
- os: windows-latest
artifact_name: rust-animation-examples-windows
build_deps: ""
- os: macos-latest
artifact_name: rust-animation-examples-macos
build_deps: ""

steps:
- uses: actions/checkout@v3

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Install dependencies
if: matrix.build_deps != ''
run: ${{ matrix.build_deps }}

- name: Build examples
run: cargo build --examples --release

- name: Package examples (Unix)
if: runner.os != 'Windows'
run: |
mkdir -p artifacts
cp target/release/examples/* artifacts/ 2>/dev/null || true
cd artifacts
tar -czf ../${{ matrix.artifact_name }}.tar.gz * || true

- name: Package examples (Windows)
if: runner.os == 'Windows'
run: |
mkdir artifacts
Copy-Item target\release\examples\*.exe artifacts\ -ErrorAction SilentlyContinue
Compress-Archive -Path artifacts\* -DestinationPath ${{ matrix.artifact_name }}.zip

- name: Upload Release Assets
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.create-release.outputs.tag_name }}
files: |
*.tar.gz
*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added
- Automated GitHub release process with workflow_dispatch trigger
- CHANGELOG.md for tracking release notes

## [0.2.8] - 2024-XX-XX

### Changed
- Migrated from OpenGL to wgpu 22.1.0 for rendering
- Updated all examples to use winit 0.29.15 with wgpu
- Breaking API changes: set_text now requires wgpu device and queue parameters

### Added
- CoreAnimation-style API for better iOS/macOS developer familiarity
- WGSL shaders for wgpu backend
- Comprehensive migration guide in MIGRATION.md

### Fixed
- Improved macOS compatibility with explicit wgpu backend configuration
- Removed all unsafe code blocks for safer API

### Removed
- OpenGL/GLSL rendering backend
- glfw dependency in favor of winit

[Unreleased]: https://github.com/joone/rust-animation/compare/v0.2.8...HEAD
[0.2.8]: https://github.com/joone/rust-animation/releases/tag/v0.2.8
120 changes: 120 additions & 0 deletions RELEASE_QUICKSTART.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# Automated Release Process - Quick Start Guide

This repository now has a **fully automated GitHub release process** with multiple options for triggering releases.

## 🚀 Three Ways to Release

### Option 1: Push Button Release (Recommended for Quick Releases)

**Perfect when:** You've already committed version changes and want to release with one click.

1. Update `Cargo.toml` version and `CHANGELOG.md`
2. Commit and push to main
3. Go to **Actions** → **Create Release** → **Run workflow** button
4. Enter version (e.g., `0.2.9`) and click "Run workflow"
5. Done! 🎉

The workflow will automatically:
- Create the git tag
- Run tests
- Create GitHub Release with changelog
- Publish to crates.io
- Build example binaries for Linux/macOS/Windows

### Option 2: Use the Version Bump Script (Recommended for Developers)

**Perfect when:** You want automation to help with version management.

```bash
# Bump version (patch: 0.2.8 → 0.2.9)
./bump-version.sh patch

# Update CHANGELOG.md with your changes
# (The script creates a new section for you)

# Commit and push
git add Cargo.toml CHANGELOG.md
git commit -m "Bump version to 0.2.9"
git push origin main

# Create and push tag
git tag v0.2.9
git push origin v0.2.9
```

### Option 3: Traditional Tag-Based (Classic Approach)

**Perfect when:** You prefer the traditional git workflow.

```bash
# Update Cargo.toml and CHANGELOG.md manually
# Commit and push
git add Cargo.toml CHANGELOG.md
git commit -m "Bump version to 0.2.9"
git push origin main

# Create and push tag
git tag v0.2.9
git push origin v0.2.9
```

## 📋 What You Get

Every release automatically includes:

✅ **GitHub Release** with formatted release notes from CHANGELOG.md
✅ **crates.io Publication** for Rust users
✅ **Example Binaries** for Linux, macOS, and Windows
✅ **Automated Testing** before release
✅ **Version Validation** to catch mistakes

## 📁 Files Added

- **`.github/workflows/release.yml`** - Main release automation workflow
- **`CHANGELOG.md`** - Track changes between versions
- **`bump-version.sh`** - Helper script for version management
- **`RELEASING.md`** - Comprehensive release documentation

## 🔧 Setup Required

Only one setup step is needed:

1. Ensure `CRATES_IO_TOKEN` secret is configured in repository settings
- Go to Settings → Secrets and variables → Actions
- Should already exist if you've published before

## 🎯 Next Steps

**For your next release:**

1. Choose your preferred method above
2. Update CHANGELOG.md with changes
3. Follow the steps for your chosen method
4. Monitor Actions tab to watch the automation

**Questions?**

- See detailed docs: `RELEASING.md`
- Check workflow definition: `.github/workflows/release.yml`
- Run version script help: `./bump-version.sh`

## 🎨 Example Changelog Entry

```markdown
## [0.2.9] - 2024-01-15

### Added
- New particle effects system
- Improved animation easing functions

### Fixed
- Memory leak in texture loading
- Crash on window resize

### Changed
- Updated wgpu to version 23.0.0
```

---

**Happy Releasing! 🚀**
Loading