mirror of
https://github.com/Novattz/creamlinux-installer.git
synced 2026-01-28 14:22:49 -05:00
215 lines
7.4 KiB
YAML
215 lines
7.4 KiB
YAML
name: Release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
# For the Tauri updater public key
|
|
TAURI_PUBLIC_KEY: ${{ secrets.TAURI_PUBLIC_KEY }}
|
|
# For signing the updates
|
|
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
|
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
|
|
|
|
jobs:
|
|
semantic-release:
|
|
runs-on: ubuntu-latest
|
|
# Skip if this is already a tag push
|
|
if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')
|
|
outputs:
|
|
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
|
|
new_release_version: ${{ steps.semantic.outputs.new_release_version }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0 # Required for semantic-release
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: 'npm'
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Run semantic-release
|
|
id: semantic
|
|
run: npx semantic-release
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
build-and-release:
|
|
needs: [semantic-release]
|
|
# Only run if a new release was published or if this is a tag push
|
|
if: needs.semantic-release.outputs.new_release_published == 'true' || startsWith(github.ref, 'refs/tags/')
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
platform: [ubuntu-latest]
|
|
|
|
runs-on: ${{ matrix.platform }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
# If this is a tag push, we need to check out that specific tag
|
|
ref: ${{ startsWith(github.ref, 'refs/tags/') && github.ref || github.event.repository.default_branch }}
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: 'npm'
|
|
|
|
- name: Install frontend dependencies
|
|
run: npm ci
|
|
|
|
- name: Run ESLint
|
|
run: npm run lint
|
|
|
|
- name: Install Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Cache Rust dependencies
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: 'src-tauri -> target'
|
|
cache-on-failure: true
|
|
|
|
# Setup platform-specific dependencies
|
|
- name: Install Linux dependencies
|
|
if: matrix.platform == 'ubuntu-latest'
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
|
|
|
|
- name: Install macOS dependencies
|
|
if: matrix.platform == 'macos-latest'
|
|
run: |
|
|
rustup target add aarch64-apple-darwin
|
|
|
|
- name: Install Windows dependencies
|
|
if: matrix.platform == 'windows-latest'
|
|
run: |
|
|
# Windows typically doesn't need additional dependencies
|
|
|
|
# Install glob for the updater script
|
|
- name: Install glob for updater
|
|
if: matrix.platform == 'ubuntu-latest'
|
|
run: npm install -g glob
|
|
|
|
# Sync package version
|
|
- name: Sync Version
|
|
run: npm run sync-version
|
|
|
|
# Build the app with updater artifacts
|
|
- name: Build the app
|
|
run: npm run tauri build
|
|
|
|
# Upload the artifacts for each platform
|
|
- name: Upload Linux artifacts
|
|
if: matrix.platform == 'ubuntu-latest'
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: creamlinux-linux
|
|
path: |
|
|
src-tauri/target/release/bundle/deb/*.deb
|
|
src-tauri/target/release/bundle/appimage/*.AppImage
|
|
src-tauri/target/release/bundle/appimage/*.AppImage.sig
|
|
|
|
- name: Upload macOS artifacts
|
|
if: matrix.platform == 'macos-latest'
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: creamlinux-macos
|
|
path: |
|
|
src-tauri/target/release/bundle/macos/*.app
|
|
src-tauri/target/release/bundle/macos/*.app.tar.gz
|
|
src-tauri/target/release/bundle/macos/*.app.tar.gz.sig
|
|
src-tauri/target/release/bundle/dmg/*.dmg
|
|
|
|
- name: Upload Windows artifacts
|
|
if: matrix.platform == 'windows-latest'
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: creamlinux-windows
|
|
path: |
|
|
src-tauri/target/release/bundle/msi/*.msi
|
|
src-tauri/target/release/bundle/msi/*.msi.sig
|
|
src-tauri/target/release/bundle/nsis/*.exe
|
|
src-tauri/target/release/bundle/nsis/*.exe.sig
|
|
|
|
create-github-release:
|
|
needs: [semantic-release, build-and-release]
|
|
runs-on: ubuntu-latest
|
|
# Only run if we have a tag (either from semantic-release or a manual tag push)
|
|
if: needs.semantic-release.outputs.new_release_published == 'true' || startsWith(github.ref, 'refs/tags/')
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
|
|
- name: Install glob
|
|
run: npm install -g glob
|
|
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: artifacts
|
|
|
|
# Flatten the artifacts structure
|
|
- name: Prepare artifacts for release
|
|
run: |
|
|
mkdir -p release_assets
|
|
find artifacts -type f -name "*.deb" -o -name "*.AppImage" -o -name "*.AppImage.sig" -o -name "*.dmg" -o -name "*.app.tar.gz" -o -name "*.app.tar.gz.sig" -o -name "*.msi" -o -name "*.msi.sig" -o -name "*.exe" -o -name "*.exe.sig" | xargs -I{} cp {} release_assets/
|
|
|
|
# Generate updater JSON
|
|
- name: Generate updater JSON
|
|
run: |
|
|
npm install glob
|
|
# Get version from refs/tags/v1.0.0 format
|
|
VERSION="${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || needs.semantic-release.outputs.new_release_version }}"
|
|
VERSION="${VERSION#v}" # Remove 'v' prefix if it exists
|
|
echo "Release version: $VERSION"
|
|
|
|
# Create a simple updater JSON
|
|
cat > release_assets/latest.json << EOF
|
|
{
|
|
"version": "$VERSION",
|
|
"notes": "Release version $VERSION",
|
|
"pub_date": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")",
|
|
"platforms": {
|
|
"windows-x86_64": {
|
|
"url": "https://github.com/${{ github.repository }}/releases/download/v$VERSION/creamlinux_$VERSION_x64_en-US.msi",
|
|
"signature": "$(cat artifacts/creamlinux-windows/msi/*.msi.sig 2>/dev/null || echo '')"
|
|
},
|
|
"linux-x86_64": {
|
|
"url": "https://github.com/${{ github.repository }}/releases/download/v$VERSION/Creamlinux_${VERSION}_amd64.AppImage",
|
|
"signature": "$(cat artifacts/creamlinux-linux/appimage/*.AppImage.sig 2>/dev/null || echo '')"
|
|
},
|
|
"darwin-universal": {
|
|
"url": "https://github.com/${{ github.repository }}/releases/download/v$VERSION/creamlinux.app.tar.gz",
|
|
"signature": "$(cat artifacts/creamlinux-macos/macos/*.app.tar.gz.sig 2>/dev/null || echo '')"
|
|
}
|
|
}
|
|
}
|
|
EOF
|
|
|
|
cat release_assets/latest.json
|
|
|
|
# Create GitHub release
|
|
- name: Create GitHub release
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
files: release_assets/*
|
|
tag_name: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || format('v{0}', needs.semantic-release.outputs.new_release_version) }}
|
|
generate_release_notes: true
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|