269 lines
8.1 KiB
YAML
269 lines
8.1 KiB
YAML
name: Build and Release Clouck
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
- "[0-9]+.[0-9]+.[0-9]+"
|
|
branches:
|
|
- main
|
|
- master
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: "Version to build (e.g., v1.0.0)"
|
|
required: true
|
|
default: "v1.0.0"
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: read
|
|
|
|
jobs:
|
|
build-macos:
|
|
runs-on: macos-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Install Qt
|
|
uses: jurplel/install-qt-action@v4
|
|
with:
|
|
version: "6.5.*"
|
|
cache: true
|
|
|
|
- name: Configure and Build
|
|
run: |
|
|
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
|
|
cmake --build build --config Release
|
|
|
|
- name: Create macOS App Bundle
|
|
run: |
|
|
# Check what was actually built
|
|
echo "Contents of build directory:"
|
|
ls -la build/
|
|
|
|
# Look for the .app bundle or executable
|
|
if [ -d "build/Clouck.app" ]; then
|
|
echo "Found .app bundle"
|
|
cp -r build/Clouck.app ./
|
|
elif [ -f "build/Clouck" ]; then
|
|
echo "Found standalone executable"
|
|
# Create app bundle
|
|
mkdir -p Clouck.app/Contents/MacOS
|
|
mkdir -p Clouck.app/Contents/Resources
|
|
cp build/Clouck Clouck.app/Contents/MacOS/
|
|
else
|
|
echo "Looking for executable in build directory..."
|
|
find build/ -name "Clouck*" -type f
|
|
# Try to find and copy the first executable
|
|
EXECUTABLE=$(find build/ -name "Clouck*" -type f | head -1)
|
|
if [ -n "$EXECUTABLE" ]; then
|
|
echo "Found executable: $EXECUTABLE"
|
|
mkdir -p Clouck.app/Contents/MacOS
|
|
mkdir -p Clouck.app/Contents/Resources
|
|
cp "$EXECUTABLE" Clouck.app/Contents/MacOS/
|
|
else
|
|
echo "ERROR: No Clouck executable found!"
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
# Create Info.plist
|
|
cat > Clouck.app/Contents/Info.plist << EOF
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
<plist version="1.0">
|
|
<dict>
|
|
<key>CFBundleExecutable</key>
|
|
<string>Clouck</string>
|
|
<key>CFBundleIdentifier</key>
|
|
<string>com.clouck.app</string>
|
|
<key>CFBundleName</key>
|
|
<string>Clouck</string>
|
|
<key>CFBundleVersion</key>
|
|
<string>1.0.0</string>
|
|
<key>CFBundlePackageType</key>
|
|
<string>APPL</string>
|
|
<key>LSUIElement</key>
|
|
<true/>
|
|
</dict>
|
|
</plist>
|
|
EOF
|
|
|
|
- name: Deploy Qt Dependencies
|
|
run: |
|
|
if [ -d "Clouck.app" ]; then
|
|
macdeployqt Clouck.app -dmg || hdiutil create -volname "Clouck" -srcfolder Clouck.app -ov -format UDZO Clouck.dmg
|
|
else
|
|
echo "ERROR: Clouck.app not found!"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Upload macOS Artifact
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: Clouck-macos
|
|
path: Clouck.dmg
|
|
|
|
build-windows:
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Install Qt
|
|
uses: jurplel/install-qt-action@v4
|
|
with:
|
|
version: "6.5.*"
|
|
cache: true
|
|
|
|
- name: Configure and Build
|
|
run: |
|
|
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
|
|
cmake --build build --config Release
|
|
|
|
- name: Create Windows Distribution
|
|
shell: pwsh
|
|
run: |
|
|
# Check what was actually built
|
|
Get-ChildItem -Path "build" -Recurse -Name
|
|
|
|
New-Item -ItemType Directory -Path Clouck-win -Force
|
|
Copy-Item "build/Release/Clouck.exe" -Destination "Clouck-win/" -ErrorAction SilentlyContinue
|
|
Copy-Item "build/Release/*.dll" -Destination "Clouck-win/" -ErrorAction SilentlyContinue
|
|
windeployqt --release Clouck-win/Clouck.exe
|
|
Compress-Archive -Path Clouck-win -DestinationPath Clouck-win.zip
|
|
|
|
- name: Upload Windows Artifact
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: Clouck-win
|
|
path: Clouck-win.zip
|
|
|
|
build-linux:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Install Dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y build-essential cmake libx11-dev libxfixes-dev
|
|
|
|
- name: Install Qt
|
|
uses: jurplel/install-qt-action@v4
|
|
with:
|
|
version: "6.5.*"
|
|
cache: true
|
|
|
|
- name: Configure CMake
|
|
run: |
|
|
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
|
|
|
|
- name: Build
|
|
run: cmake --build build --config Release
|
|
|
|
- name: Create Linux Distribution
|
|
run: |
|
|
# Check what was actually built
|
|
echo "Contents of build directory:"
|
|
ls -la build/
|
|
|
|
# Look for the executable
|
|
EXECUTABLE=$(find build/ -name "Clouck" -type f -executable | head -1)
|
|
if [ -n "$EXECUTABLE" ]; then
|
|
echo "Found executable: $EXECUTABLE"
|
|
mkdir -p Clouck-linux
|
|
cp "$EXECUTABLE" Clouck-linux/
|
|
else
|
|
echo "ERROR: No Clouck executable found!"
|
|
exit 1
|
|
fi
|
|
|
|
# Copy any Qt libraries
|
|
find build/ -name "*.so*" -exec cp {} Clouck-linux/ \; 2>/dev/null || true
|
|
|
|
# Create tar.gz for distribution
|
|
tar -czf Clouck-linux.tar.gz Clouck-linux/
|
|
|
|
- name: Upload Linux Artifact
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: Clouck-linux
|
|
path: Clouck-linux.tar.gz
|
|
|
|
generate-changelog:
|
|
needs: [ build-macos, build-windows, build-linux ]
|
|
runs-on: ubuntu-latest
|
|
if: always()
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
outputs:
|
|
changelog: ${{ steps.changelog.outputs.changelog }}
|
|
version: ${{ steps.version.outputs.version }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Get Version
|
|
id: version
|
|
run: |
|
|
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
|
|
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Generate Changelog
|
|
id: changelog
|
|
run: |
|
|
VERSION="${{ steps.version.outputs.version }}"
|
|
CHANGELOG=$(git log --pretty=format:"- %s" $(git describe --tags --abbrev=0 HEAD~1)..HEAD 2>/dev/null || echo "- Initial release")
|
|
echo "changelog<<EOF" >> $GITHUB_OUTPUT
|
|
echo "## What's New in $VERSION" >> $GITHUB_OUTPUT
|
|
echo "" >> $GITHUB_OUTPUT
|
|
echo "$CHANGELOG" >> $GITHUB_OUTPUT
|
|
echo "" >> $GITHUB_OUTPUT
|
|
echo "## Downloads" >> $GITHUB_OUTPUT
|
|
echo "- **macOS**: Clouck.dmg" >> $GITHUB_OUTPUT
|
|
echo "- **Windows**: Clouck-win.zip" >> $GITHUB_OUTPUT
|
|
echo "- **Linux**: Clouck-linux.tar.gz" >> $GITHUB_OUTPUT
|
|
echo "EOF" >> $GITHUB_OUTPUT
|
|
|
|
create-release:
|
|
needs: [ build-macos, build-windows, build-linux, generate-changelog ]
|
|
runs-on: ubuntu-latest
|
|
if: always()
|
|
permissions:
|
|
contents: write
|
|
pull-requests: read
|
|
|
|
steps:
|
|
- name: Download All Artifacts
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
path: artifacts
|
|
|
|
- name: Display Structure
|
|
run: ls -R artifacts
|
|
|
|
- name: Create Release
|
|
uses: softprops/action-gh-release@v3
|
|
with:
|
|
name: Clouck ${{ needs.generate-changelog.outputs.version }}
|
|
body: |
|
|
Cross-platform clock widget application
|
|
|
|
${{ needs.generate-changelog.outputs.changelog }}
|
|
|
|
files: |
|
|
artifacts/Clouck-macos/Clouck.dmg
|
|
artifacts/Clouck-win/Clouck-win.zip
|
|
artifacts/Clouck-linux/Clouck-linux.tar.gz
|
|
draft: false
|
|
prerelease: false
|
|
generate_release_notes: true
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|