Update license configuration and dependency formatting for PyPI release #74
Workflow file for this run
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 Process | |
on: | |
push: | |
tags: | |
- "v*" | |
- "[0-9]+.[0-9]+.[0-9]+" | |
workflow_dispatch: | |
permissions: | |
contents: write | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
HOMEBREW_TOKEN: ${{ secrets.HOMEBREW_TOKEN }} | |
jobs: | |
validate: | |
name: Pre-Release Validation | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy | |
- name: Cache dependencies | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Extract version from tag | |
id: version | |
run: | | |
VERSION=${GITHUB_REF#refs/tags/} | |
VERSION=${VERSION#v} | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
echo "Extracted version: $VERSION" | |
- name: Validate version format | |
run: | | |
VERSION="${{ steps.version.outputs.version }}" | |
if ! [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
echo "❌ Invalid version format: $VERSION" | |
echo "Expected format: X.Y.Z (e.g., 1.6.5)" | |
exit 1 | |
fi | |
echo "✅ Version format valid: $VERSION" | |
- name: Check CHANGELOG | |
run: | | |
VERSION="${{ steps.version.outputs.version }}" | |
if ! grep -q "^$VERSION (" CHANGELOG.md; then | |
echo "❌ Version $VERSION not found in CHANGELOG.md" | |
echo "Please add an entry for version $VERSION" | |
exit 1 | |
fi | |
echo "✅ CHANGELOG entry found for version $VERSION" | |
- name: Check for uncommitted changes | |
run: | | |
if ! git diff-index --quiet HEAD --; then | |
echo "❌ Uncommitted changes detected" | |
git status | |
exit 1 | |
fi | |
echo "✅ No uncommitted changes" | |
- name: Run tests | |
run: cargo test | |
- name: Run clippy | |
run: cargo clippy -- -D warnings | |
- name: Build release | |
run: cargo build --release | |
- name: Validate documentation | |
run: | | |
# Check if README exists and has content | |
if [ ! -f README.md ] || [ ! -s README.md ]; then | |
echo "❌ README.md is missing or empty" | |
exit 1 | |
fi | |
echo "✅ Documentation validation passed" | |
publish: | |
name: Publish to Cargo | |
needs: validate | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Publish to crates.io | |
run: | | |
cd tidy-viewer-cli | |
cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
build-packages: | |
name: Build Distribution Packages | |
needs: validate | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install cargo-deb | |
run: cargo install cargo-deb | |
- name: Install alien | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y alien | |
- name: Build Debian package | |
run: cargo deb --package tidy-viewer --manifest-path tidy-viewer-cli/Cargo.toml | |
- name: Build RPM package | |
run: | | |
alien --verbose --to-rpm ./target/debian/tidy-viewer_*_amd64.deb | |
mv *.rpm ./target/ | |
- name: Upload Debian package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: debian-package | |
path: ./target/debian/*.deb | |
- name: Upload RPM package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: rpm-package | |
path: ./target/*.rpm | |
build-binaries-windows: | |
name: Build Windows Binaries | |
needs: validate | |
runs-on: windows-2022 | |
strategy: | |
matrix: | |
target: [i686-pc-windows-msvc, x86_64-pc-windows-msvc] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Extract version from tag | |
id: version | |
shell: bash | |
run: | | |
VERSION=${GITHUB_REF#refs/tags/} | |
VERSION=${VERSION#v} | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.target }} | |
- name: Build (release) | |
shell: bash | |
run: | | |
cargo build --package tidy-viewer --release --target ${{ matrix.target }} | |
- name: Package zip | |
shell: pwsh | |
run: | | |
$version = "${{ steps.version.outputs.version }}" | |
$target = "${{ matrix.target }}" | |
$out = "tidy-viewer-$version-$target.zip" | |
Compress-Archive -Path "target/$target/release/tidy-viewer.exe" -DestinationPath $out | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows-${{ matrix.target }} | |
path: tidy-viewer-${{ steps.version.outputs.version }}-${{ matrix.target }}.zip | |
build-binaries-macos: | |
name: Build macOS (x86_64) Binary | |
needs: validate | |
runs-on: macos-13 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Extract version from tag | |
id: version | |
run: | | |
VERSION=${GITHUB_REF#refs/tags/} | |
VERSION=${VERSION#v} | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Build (release) | |
run: cargo build --package tidy-viewer --release | |
- name: Package tar.gz | |
run: | | |
VERSION=${{ steps.version.outputs.version }} | |
tar -C target/release -czf tidy-viewer-$VERSION-x86_64-apple-darwin.tar.gz tidy-viewer | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: macos-x86_64-apple-darwin | |
path: tidy-viewer-${{ steps.version.outputs.version }}-x86_64-apple-darwin.tar.gz | |
build-binaries-linux: | |
name: Build Linux (tgz) Binary | |
needs: validate | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Extract version from tag | |
id: version | |
run: | | |
VERSION=${GITHUB_REF#refs/tags/} | |
VERSION=${VERSION#v} | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Build (release) | |
run: cargo build --package tidy-viewer --release | |
- name: Package tgz | |
run: | | |
VERSION=${{ steps.version.outputs.version }} | |
tar -C target/release -czf tidy-viewer-$VERSION.tgz tidy-viewer | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linux-tgz | |
path: tidy-viewer-${{ steps.version.outputs.version }}.tgz | |
homebrew-update: | |
name: Update Homebrew Formulas | |
needs: [validate, publish] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Extract version | |
id: version | |
run: | | |
VERSION=${GITHUB_REF#refs/tags/} | |
VERSION=${VERSION#v} | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
- name: Get SHA256 of release tarball | |
id: sha256 | |
run: | | |
VERSION="${{ steps.version.outputs.version }}" | |
wget https://github.com/alexhallam/tv/archive/refs/tags/$VERSION.tar.gz | |
SHA256=$(sha256sum $VERSION.tar.gz | cut -d' ' -f1) | |
echo "sha256=$SHA256" >> $GITHUB_OUTPUT | |
echo "Version: $VERSION" | |
echo "SHA256: $SHA256" | |
- name: Update personal homebrew tap | |
if: env.HOMEBREW_TOKEN != '' | |
run: | | |
VERSION="${{ steps.version.outputs.version }}" | |
SHA256="${{ steps.sha256.outputs.sha256 }}" | |
# Clone personal homebrew tap with token | |
git clone https://x-access-token:${{ env.HOMEBREW_TOKEN }}@github.com/alexhallam/homebrew-tidy-viewer.git | |
cd homebrew-tidy-viewer | |
# Set up Git user identity | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
# Update formula | |
sed -i "s/version \"[^\"]*\"/version \"$VERSION\"/" tidy-viewer.rb | |
sed -i "s/sha256 \"[^\"]*\"/sha256 \"$SHA256\"/" tidy-viewer.rb | |
# Commit and push | |
git add tidy-viewer.rb | |
git commit -m "Update tidy-viewer to version $VERSION" | |
git push origin main | |
# Homebrew Core PR creation removed - user requested to skip this step | |
# as it keeps breaking and they don't have time to fix it | |
post-release: | |
name: Post-Release Verification | |
needs: | |
[ | |
publish, | |
build-packages, | |
homebrew-update, | |
build-binaries-windows, | |
build-binaries-macos, | |
build-binaries-linux, | |
] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Extract version | |
id: version | |
run: | | |
VERSION=${GITHUB_REF#refs/tags/} | |
VERSION=${VERSION#v} | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
- name: Download Debian artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: debian-package | |
path: ./artifacts/deb | |
- name: Download RPM artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: rpm-package | |
path: ./artifacts/rpm | |
- name: Download Windows x86 (i686) artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: windows-i686-pc-windows-msvc | |
path: ./artifacts/windows/i686 | |
- name: Download Windows x64 (x86_64) artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: windows-x86_64-pc-windows-msvc | |
path: ./artifacts/windows/x86_64 | |
- name: Download macOS (x86_64) artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: macos-x86_64-apple-darwin | |
path: ./artifacts/macos | |
- name: Download Linux tgz artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: linux-tgz | |
path: ./artifacts/linux | |
- name: Create GitHub Release | |
id: create_release | |
uses: softprops/action-gh-release@v2 | |
env: | |
GH_TOKEN: ${{ env.GH_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
body: | | |
## What's New in Version ${{ steps.version.outputs.version }} | |
See [CHANGELOG.md](https://github.com/alexhallam/tv/blob/main/CHANGELOG.md) for detailed changes. | |
## Installation | |
```bash | |
cargo install tidy-viewer | |
``` | |
## Downloads | |
Debian, RPM, and platform-specific archives are attached as release assets below. | |
draft: false | |
prerelease: false | |
files: | | |
./artifacts/deb/*.deb | |
./artifacts/rpm/*.rpm | |
./artifacts/windows/i686/*.zip | |
./artifacts/windows/x86_64/*.zip | |
./artifacts/macos/*.tar.gz | |
./artifacts/linux/*.tgz | |
- name: Success Summary | |
run: | | |
VERSION="${{ steps.version.outputs.version }}" | |
echo "🎉 Release $VERSION completed successfully!" | |
echo "" | |
echo "✅ Published to crates.io" | |
echo "✅ Built Debian and RPM packages" | |
echo "✅ Built Windows, macOS, and Linux binary archives" | |
echo "✅ Updated personal Homebrew tap" | |
echo "✅ Created GitHub release" | |
echo "" | |
echo "📦 Installation:" | |
echo " cargo install tidy-viewer" | |
echo " brew install tidy-viewer" |