WIP: auto update

This commit is contained in:
SoftFever
2026-01-04 21:47:07 +08:00
parent 7c91459c37
commit e35f4dbf62
17 changed files with 1141 additions and 158 deletions

View File

@@ -5,6 +5,7 @@ on:
branches:
- main
- release/*
- feature/auto-update # TODO: Remove after auto-update testing is complete
paths:
- 'deps/**'
- 'src/**'
@@ -48,25 +49,28 @@ concurrency:
jobs:
build_linux: # Separate so unit tests can wait on just Linux builds to complete.
name: Build Linux
strategy:
fail-fast: false
# Don't run scheduled builds on forks:
if: ${{ !cancelled() && (github.event_name != 'schedule' || github.repository == 'OrcaSlicer/OrcaSlicer') }}
uses: ./.github/workflows/build_deps.yml
with:
os: ubuntu-24.04
build-deps-only: ${{ inputs.build-deps-only || false }}
force-build: ${{ github.event_name == 'schedule' }}
secrets: inherit
# TODO: Re-enable after auto-update testing is complete
# build_linux: # Separate so unit tests can wait on just Linux builds to complete.
# name: Build Linux
# strategy:
# fail-fast: false
# # Don't run scheduled builds on forks:
# if: ${{ !cancelled() && (github.event_name != 'schedule' || github.repository == 'OrcaSlicer/OrcaSlicer') }}
# uses: ./.github/workflows/build_deps.yml
# with:
# os: ubuntu-24.04
# build-deps-only: ${{ inputs.build-deps-only || false }}
# force-build: ${{ github.event_name == 'schedule' }}
# secrets: inherit
build_all:
name: Build Non-Linux
name: Build macOS (testing auto-update)
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
# TODO: Re-enable Windows after auto-update testing is complete
# - os: windows-latest
- os: macos-14
arch: arm64
# Don't run scheduled builds on forks:
@@ -78,109 +82,113 @@ jobs:
build-deps-only: ${{ inputs.build-deps-only || false }}
force-build: ${{ github.event_name == 'schedule' }}
secrets: inherit
unit_tests:
name: Unit Tests
runs-on: ubuntu-24.04
needs: build_linux
if: ${{ !cancelled() && success() }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
sparse-checkout: |
.github
scripts
tests
- name: Apt-Install Dependencies
uses: ./.github/actions/apt-install-deps
- name: Restore Test Artifact
uses: actions/download-artifact@v6
with:
name: ${{ github.sha }}-tests
- uses: lukka/get-cmake@latest
with:
cmakeVersion: "~3.28.0" # use most recent 3.28.x version
- name: Unpackage and Run Unit Tests
timeout-minutes: 20
run: |
tar -xvf build_tests.tar
scripts/run_unit_tests.sh
- name: Upload Test Logs
uses: actions/upload-artifact@v5
if: ${{ failure() }}
with:
name: unit-test-logs
path: build/tests/**/*.log
- name: Publish Test Results
if: always()
uses: EnricoMi/publish-unit-test-result-action/linux@v2
with:
files: "ctest_results.xml"
flatpak:
name: "Flatpak"
container:
image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-48
options: --privileged
volumes:
- /usr/local/lib/android:/usr/local/lib/android
- /usr/share/dotnet:/usr/share/dotnet
- /opt/ghc:/opt/ghc1
- /usr/local/share/boost:/usr/local/share/boost1
- /opt/hostedtoolcache:/opt/hostedtoolcache1
strategy:
fail-fast: false
matrix:
variant:
- arch: x86_64
runner: ubuntu-24.04
- arch: aarch64
runner: ubuntu-24.04-arm
# Don't run scheduled builds on forks:
if: ${{ !cancelled() && (github.event_name != 'schedule' || github.repository == 'OrcaSlicer/OrcaSlicer') }}
runs-on: ${{ matrix.variant.runner }}
env:
date:
ver:
ver_pure:
steps:
- name: "Remove unneeded stuff to free disk space"
run:
rm -rf /usr/local/lib/android/* /usr/share/dotnet/* /opt/ghc1/* "/usr/local/share/boost1/*" /opt/hostedtoolcache1/*
- uses: actions/checkout@v6
- name: Get the version and date
run: |
ver_pure=$(grep 'set(SoftFever_VERSION' version.inc | cut -d '"' -f2)
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
ver="PR-${{ github.event.number }}"
git_commit_hash="${{ github.event.pull_request.head.sha }}"
else
ver=V$ver_pure
git_commit_hash=""
fi
echo "ver=$ver" >> $GITHUB_ENV
echo "ver_pure=$ver_pure" >> $GITHUB_ENV
echo "date=$(date +'%Y%m%d')" >> $GITHUB_ENV
echo "git_commit_hash=$git_commit_hash" >> $GITHUB_ENV
shell: bash
- uses: flatpak/flatpak-github-actions/flatpak-builder@master
with:
bundle: OrcaSlicer-Linux-flatpak_${{ env.ver }}_${{ matrix.variant.arch }}.flatpak
manifest-path: scripts/flatpak/io.github.softfever.OrcaSlicer.yml
cache: true
arch: ${{ matrix.variant.arch }}
upload-artifact: false
- name: Upload artifacts Flatpak
uses: actions/upload-artifact@v5
with:
name: OrcaSlicer-Linux-flatpak_${{ env.ver }}_${{ matrix.variant.arch }}.flatpak
path: '/__w/OrcaSlicer/OrcaSlicer/OrcaSlicer-Linux-flatpak_${{ env.ver }}_${{ matrix.variant.arch }}.flatpak'
- name: Deploy Flatpak to nightly release
if: github.repository == 'OrcaSlicer/OrcaSlicer' && github.ref == 'refs/heads/main'
uses: WebFreak001/deploy-nightly@v3.2.0
with:
upload_url: https://uploads.github.com/repos/OrcaSlicer/OrcaSlicer/releases/137995723/assets{?name,label}
release_id: 137995723
asset_path: /__w/OrcaSlicer/OrcaSlicer/OrcaSlicer-Linux-flatpak_${{ env.ver }}_${{ matrix.variant.arch }}.flatpak
asset_name: OrcaSlicer-Linux-flatpak_nightly_${{ matrix.variant.arch }}.flatpak
asset_content_type: application/octet-stream
max_releases: 1 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted
# TODO: Re-enable after auto-update testing is complete (depends on build_linux)
# unit_tests:
# name: Unit Tests
# runs-on: ubuntu-24.04
# needs: build_linux
# if: ${{ !cancelled() && success() }}
# steps:
# - name: Checkout
# uses: actions/checkout@v6
# with:
# sparse-checkout: |
# .github
# scripts
# tests
# - name: Apt-Install Dependencies
# uses: ./.github/actions/apt-install-deps
# - name: Restore Test Artifact
# uses: actions/download-artifact@v6
# with:
# name: ${{ github.sha }}-tests
# - uses: lukka/get-cmake@latest
# with:
# cmakeVersion: "~3.28.0" # use most recent 3.28.x version
# - name: Unpackage and Run Unit Tests
# timeout-minutes: 20
# run: |
# tar -xvf build_tests.tar
# scripts/run_unit_tests.sh
# - name: Upload Test Logs
# uses: actions/upload-artifact@v5
# if: ${{ failure() }}
# with:
# name: unit-test-logs
# path: build/tests/**/*.log
# - name: Publish Test Results
# if: always()
# uses: EnricoMi/publish-unit-test-result-action/linux@v2
# with:
# files: "ctest_results.xml"
# TODO: Re-enable after auto-update testing is complete
# flatpak:
# name: "Flatpak"
# container:
# image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-48
# options: --privileged
# volumes:
# - /usr/local/lib/android:/usr/local/lib/android
# - /usr/share/dotnet:/usr/share/dotnet
# - /opt/ghc:/opt/ghc1
# - /usr/local/share/boost:/usr/local/share/boost1
# - /opt/hostedtoolcache:/opt/hostedtoolcache1
# strategy:
# fail-fast: false
# matrix:
# variant:
# - arch: x86_64
# runner: ubuntu-24.04
# - arch: aarch64
# runner: ubuntu-24.04-arm
# # Don't run scheduled builds on forks:
# if: ${{ !cancelled() && (github.event_name != 'schedule' || github.repository == 'OrcaSlicer/OrcaSlicer') }}
# runs-on: ${{ matrix.variant.runner }}
# env:
# date:
# ver:
# ver_pure:
# steps:
# - name: "Remove unneeded stuff to free disk space"
# run:
# rm -rf /usr/local/lib/android/* /usr/share/dotnet/* /opt/ghc1/* "/usr/local/share/boost1/*" /opt/hostedtoolcache1/*
# - uses: actions/checkout@v6
# - name: Get the version and date
# run: |
# ver_pure=$(grep 'set(SoftFever_VERSION' version.inc | cut -d '"' -f2)
# if [[ "${{ github.event_name }}" == "pull_request" ]]; then
# ver="PR-${{ github.event.number }}"
# git_commit_hash="${{ github.event.pull_request.head.sha }}"
# else
# ver=V$ver_pure
# git_commit_hash=""
# fi
# echo "ver=$ver" >> $GITHUB_ENV
# echo "ver_pure=$ver_pure" >> $GITHUB_ENV
# echo "date=$(date +'%Y%m%d')" >> $GITHUB_ENV
# echo "git_commit_hash=$git_commit_hash" >> $GITHUB_ENV
# shell: bash
# - uses: flatpak/flatpak-github-actions/flatpak-builder@master
# with:
# bundle: OrcaSlicer-Linux-flatpak_${{ env.ver }}_${{ matrix.variant.arch }}.flatpak
# manifest-path: scripts/flatpak/io.github.softfever.OrcaSlicer.yml
# cache: true
# arch: ${{ matrix.variant.arch }}
# upload-artifact: false
# - name: Upload artifacts Flatpak
# uses: actions/upload-artifact@v5
# with:
# name: OrcaSlicer-Linux-flatpak_${{ env.ver }}_${{ matrix.variant.arch }}.flatpak
# path: '/__w/OrcaSlicer/OrcaSlicer/OrcaSlicer-Linux-flatpak_${{ env.ver }}_${{ matrix.variant.arch }}.flatpak'
# - name: Deploy Flatpak to nightly release
# if: github.repository == 'OrcaSlicer/OrcaSlicer' && github.ref == 'refs/heads/main'
# uses: WebFreak001/deploy-nightly@v3.2.0
# with:
# upload_url: https://uploads.github.com/repos/OrcaSlicer/OrcaSlicer/releases/137995723/assets{?name,label}
# release_id: 137995723
# asset_path: /__w/OrcaSlicer/OrcaSlicer/OrcaSlicer-Linux-flatpak_${{ env.ver }}_${{ matrix.variant.arch }}.flatpak
# asset_name: OrcaSlicer-Linux-flatpak_nightly_${{ matrix.variant.arch }}.flatpak
# asset_content_type: application/octet-stream
# max_releases: 1 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted

View File

@@ -103,11 +103,13 @@ jobs:
if: inputs.os == 'macos-14'
working-directory: ${{ github.workspace }}
run: |
./build_release_macos.sh -s -n -x -a universal -t 10.15 -1
# TODO: Change back to -a universal after auto-update testing is complete
./build_release_macos.sh -s -n -x -a arm64 -t 10.15 -1
# Thanks to RaySajuuk, it's working now
- name: Sign app and notary
if: github.repository == 'OrcaSlicer/OrcaSlicer' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) && inputs.os == 'macos-14'
# TODO: Remove feature/auto-update after testing is complete
if: github.repository == 'OrcaSlicer/OrcaSlicer' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || github.ref == 'refs/heads/feature/auto-update') && inputs.os == 'macos-14'
working-directory: ${{ github.workspace }}
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
@@ -124,27 +126,28 @@ jobs:
security import $CERTIFICATE_PATH -P $P12_PASSWORD -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $P12_PASSWORD $KEYCHAIN_PATH
codesign --deep --force --verbose --options runtime --timestamp --entitlements ${{ github.workspace }}/scripts/disable_validation.entitlements --sign "$CERTIFICATE_ID" ${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer.app
# TODO: Change build/arm64 back to build/universal after auto-update testing is complete
codesign --deep --force --verbose --options runtime --timestamp --entitlements ${{ github.workspace }}/scripts/disable_validation.entitlements --sign "$CERTIFICATE_ID" ${{ github.workspace }}/build/arm64/OrcaSlicer/OrcaSlicer.app
# Sign OrcaSlicer_profile_validator.app if it exists
if [ -f "${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer_profile_validator.app/Contents/MacOS/OrcaSlicer_profile_validator" ]; then
codesign --deep --force --verbose --options runtime --timestamp --entitlements ${{ github.workspace }}/scripts/disable_validation.entitlements --sign "$CERTIFICATE_ID" ${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer_profile_validator.app
if [ -f "${{ github.workspace }}/build/arm64/OrcaSlicer/OrcaSlicer_profile_validator.app/Contents/MacOS/OrcaSlicer_profile_validator" ]; then
codesign --deep --force --verbose --options runtime --timestamp --entitlements ${{ github.workspace }}/scripts/disable_validation.entitlements --sign "$CERTIFICATE_ID" ${{ github.workspace }}/build/arm64/OrcaSlicer/OrcaSlicer_profile_validator.app
fi
# Create main OrcaSlicer DMG without the profile validator helper
mkdir -p ${{ github.workspace }}/build/universal/OrcaSlicer_dmg
rm -rf ${{ github.workspace }}/build/universal/OrcaSlicer_dmg/*
cp -R ${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer.app ${{ github.workspace }}/build/universal/OrcaSlicer_dmg/
ln -sfn /Applications ${{ github.workspace }}/build/universal/OrcaSlicer_dmg/Applications
hdiutil create -volname "OrcaSlicer" -srcfolder ${{ github.workspace }}/build/universal/OrcaSlicer_dmg -ov -format UDZO OrcaSlicer_Mac_universal_${{ env.ver }}.dmg
mkdir -p ${{ github.workspace }}/build/arm64/OrcaSlicer_dmg
rm -rf ${{ github.workspace }}/build/arm64/OrcaSlicer_dmg/*
cp -R ${{ github.workspace }}/build/arm64/OrcaSlicer/OrcaSlicer.app ${{ github.workspace }}/build/arm64/OrcaSlicer_dmg/
ln -sfn /Applications ${{ github.workspace }}/build/arm64/OrcaSlicer_dmg/Applications
hdiutil create -volname "OrcaSlicer" -srcfolder ${{ github.workspace }}/build/arm64/OrcaSlicer_dmg -ov -format UDZO OrcaSlicer_Mac_universal_${{ env.ver }}.dmg
codesign --deep --force --verbose --options runtime --timestamp --entitlements ${{ github.workspace }}/scripts/disable_validation.entitlements --sign "$CERTIFICATE_ID" OrcaSlicer_Mac_universal_${{ env.ver }}.dmg
# Create separate OrcaSlicer_profile_validator DMG if the app exists
if [ -f "${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer_profile_validator.app/Contents/MacOS/OrcaSlicer_profile_validator" ]; then
mkdir -p ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg
rm -rf ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg/*
cp -R ${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer_profile_validator.app ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg/
ln -sfn /Applications ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg/Applications
hdiutil create -volname "OrcaSlicer Profile Validator" -srcfolder ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg -ov -format UDZO OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg
if [ -f "${{ github.workspace }}/build/arm64/OrcaSlicer/OrcaSlicer_profile_validator.app/Contents/MacOS/OrcaSlicer_profile_validator" ]; then
mkdir -p ${{ github.workspace }}/build/arm64/OrcaSlicer_profile_validator_dmg
rm -rf ${{ github.workspace }}/build/arm64/OrcaSlicer_profile_validator_dmg/*
cp -R ${{ github.workspace }}/build/arm64/OrcaSlicer/OrcaSlicer_profile_validator.app ${{ github.workspace }}/build/arm64/OrcaSlicer_profile_validator_dmg/
ln -sfn /Applications ${{ github.workspace }}/build/arm64/OrcaSlicer_profile_validator_dmg/Applications
hdiutil create -volname "OrcaSlicer Profile Validator" -srcfolder ${{ github.workspace }}/build/arm64/OrcaSlicer_profile_validator_dmg -ov -format UDZO OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg
codesign --deep --force --verbose --options runtime --timestamp --entitlements ${{ github.workspace }}/scripts/disable_validation.entitlements --sign "$CERTIFICATE_ID" OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg
fi
@@ -159,23 +162,65 @@ jobs:
xcrun stapler staple OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg
fi
- name: Sign DMG for Sparkle auto-update
# TODO: Remove feature/auto-update after testing is complete
if: github.repository == 'OrcaSlicer/OrcaSlicer' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || github.ref == 'refs/heads/feature/auto-update') && inputs.os == 'macos-14'
working-directory: ${{ github.workspace }}
env:
SPARKLE_PRIVATE_KEY: ${{ secrets.SPARKLE_PRIVATE_KEY }}
run: |
# Get the Sparkle sign_update tool from deps (installed to OrcaSlicer_dep/bin)
SIGN_UPDATE="${{ github.workspace }}/deps/build/arm64/OrcaSlicer_dep/bin/sign_update"
# Fallback to x86_64 if arm64 not found
if [ ! -f "$SIGN_UPDATE" ]; then
SIGN_UPDATE="${{ github.workspace }}/deps/build/x86_64/OrcaSlicer_dep/bin/sign_update"
fi
if [ -f "$SIGN_UPDATE" ] && [ -n "$SPARKLE_PRIVATE_KEY" ]; then
# Write the private key to a temp file
echo "$SPARKLE_PRIVATE_KEY" > /tmp/sparkle_private_key
chmod 600 /tmp/sparkle_private_key
# Sign the DMG and capture the signature
SIGNATURE=$("$SIGN_UPDATE" "OrcaSlicer_Mac_universal_${{ env.ver }}.dmg" -f /tmp/sparkle_private_key)
# Clean up the key file
rm -f /tmp/sparkle_private_key
# Save signature to a file for later use in appcast generation
echo "$SIGNATURE" > OrcaSlicer_Mac_universal_${{ env.ver }}.dmg.sig
echo "Sparkle signature generated: $SIGNATURE"
# Also output as GitHub Actions output
echo "sparkle_signature=$SIGNATURE" >> $GITHUB_OUTPUT
else
echo "Warning: Sparkle sign_update tool not found at $SIGN_UPDATE or private key not set, skipping signature generation"
if [ ! -f "$SIGN_UPDATE" ]; then
echo "sign_update not found. Available files:"
ls -la "${{ github.workspace }}/deps/build/arm64/OrcaSlicer_dep/" || true
fi
fi
- name: Create DMG without notary
if: github.ref != 'refs/heads/main' && inputs.os == 'macos-14'
# TODO: Remove feature/auto-update exclusion after testing is complete
if: github.ref != 'refs/heads/main' && github.ref != 'refs/heads/feature/auto-update' && !startsWith(github.ref, 'refs/heads/release/') && inputs.os == 'macos-14'
working-directory: ${{ github.workspace }}
run: |
mkdir -p ${{ github.workspace }}/build/universal/OrcaSlicer_dmg
rm -rf ${{ github.workspace }}/build/universal/OrcaSlicer_dmg/*
cp -R ${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer.app ${{ github.workspace }}/build/universal/OrcaSlicer_dmg/
ln -sfn /Applications ${{ github.workspace }}/build/universal/OrcaSlicer_dmg/Applications
hdiutil create -volname "OrcaSlicer" -srcfolder ${{ github.workspace }}/build/universal/OrcaSlicer_dmg -ov -format UDZO OrcaSlicer_Mac_universal_${{ env.ver }}.dmg
# TODO: Change build/arm64 back to build/universal after auto-update testing is complete
mkdir -p ${{ github.workspace }}/build/arm64/OrcaSlicer_dmg
rm -rf ${{ github.workspace }}/build/arm64/OrcaSlicer_dmg/*
cp -R ${{ github.workspace }}/build/arm64/OrcaSlicer/OrcaSlicer.app ${{ github.workspace }}/build/arm64/OrcaSlicer_dmg/
ln -sfn /Applications ${{ github.workspace }}/build/arm64/OrcaSlicer_dmg/Applications
hdiutil create -volname "OrcaSlicer" -srcfolder ${{ github.workspace }}/build/arm64/OrcaSlicer_dmg -ov -format UDZO OrcaSlicer_Mac_universal_${{ env.ver }}.dmg
# Create separate OrcaSlicer_profile_validator DMG if the app exists
if [ -f "${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer_profile_validator.app/Contents/MacOS/OrcaSlicer_profile_validator" ]; then
mkdir -p ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg
rm -rf ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg/*
cp -R ${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer_profile_validator.app ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg/
ln -sfn /Applications ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg/Applications
hdiutil create -volname "OrcaSlicer Profile Validator" -srcfolder ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg -ov -format UDZO OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg
if [ -f "${{ github.workspace }}/build/arm64/OrcaSlicer/OrcaSlicer_profile_validator.app/Contents/MacOS/OrcaSlicer_profile_validator" ]; then
mkdir -p ${{ github.workspace }}/build/arm64/OrcaSlicer_profile_validator_dmg
rm -rf ${{ github.workspace }}/build/arm64/OrcaSlicer_profile_validator_dmg/*
cp -R ${{ github.workspace }}/build/arm64/OrcaSlicer/OrcaSlicer_profile_validator.app ${{ github.workspace }}/build/arm64/OrcaSlicer_profile_validator_dmg/
ln -sfn /Applications ${{ github.workspace }}/build/arm64/OrcaSlicer_profile_validator_dmg/Applications
hdiutil create -volname "OrcaSlicer Profile Validator" -srcfolder ${{ github.workspace }}/build/arm64/OrcaSlicer_profile_validator_dmg -ov -format UDZO OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg
fi
- name: Upload artifacts mac
@@ -185,6 +230,14 @@ jobs:
name: OrcaSlicer_Mac_universal_${{ env.ver }}
path: ${{ github.workspace }}/OrcaSlicer_Mac_universal_${{ env.ver }}.dmg
- name: Upload Sparkle signature mac
if: inputs.os == 'macos-14'
uses: actions/upload-artifact@v5
with:
name: OrcaSlicer_Mac_universal_${{ env.ver }}_sig
path: ${{ github.workspace }}/OrcaSlicer_Mac_universal_${{ env.ver }}.dmg.sig
if-no-files-found: ignore
- name: Upload OrcaSlicer_profile_validator DMG mac
if: inputs.os == 'macos-14'
uses: actions/upload-artifact@v5

138
.github/workflows/generate_appcast.yml vendored Normal file
View File

@@ -0,0 +1,138 @@
name: Generate Appcast
on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: 'Version to generate appcast for (e.g., 2.3.2)'
required: true
jobs:
generate_appcast:
name: Generate and Deploy Appcast
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Get version from release or input
id: version
run: |
if [ "${{ github.event_name }}" == "release" ]; then
VERSION="${{ github.event.release.tag_name }}"
VERSION="${VERSION#v}" # Remove 'v' prefix if present
else
VERSION="${{ github.event.inputs.version }}"
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
- name: Download release assets info
id: assets
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${{ steps.version.outputs.version }}"
TAG="v$VERSION"
# Get release info
RELEASE_URL="https://github.com/${{ github.repository }}/releases/tag/$TAG"
echo "release_url=$RELEASE_URL" >> $GITHUB_OUTPUT
# Get macOS DMG URL and size
# Use browser_download_url for public access (not .url which is the API endpoint)
MAC_ASSET=$(gh release view "$TAG" --json assets -q '.assets[] | select(.name | contains("Mac_universal")) | select(.name | endswith(".dmg"))')
if [ -n "$MAC_ASSET" ]; then
MAC_URL=$(echo "$MAC_ASSET" | jq -r '.browser_download_url // .url')
MAC_SIZE=$(echo "$MAC_ASSET" | jq -r '.size')
echo "mac_url=$MAC_URL" >> $GITHUB_OUTPUT
echo "mac_size=$MAC_SIZE" >> $GITHUB_OUTPUT
fi
# Get Windows installer URL and size
# Use browser_download_url for public access (not .url which is the API endpoint)
WIN_ASSET=$(gh release view "$TAG" --json assets -q '.assets[] | select(.name | contains("Windows_Installer")) | select(.name | endswith(".exe"))')
if [ -n "$WIN_ASSET" ]; then
WIN_URL=$(echo "$WIN_ASSET" | jq -r '.browser_download_url // .url')
WIN_SIZE=$(echo "$WIN_ASSET" | jq -r '.size')
echo "win_url=$WIN_URL" >> $GITHUB_OUTPUT
echo "win_size=$WIN_SIZE" >> $GITHUB_OUTPUT
fi
- name: Download signatures
id: signatures
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${{ steps.version.outputs.version }}"
TAG="v$VERSION"
# Try to download macOS signature artifact
MAC_SIG_ARTIFACT="OrcaSlicer_Mac_universal_V${VERSION}_sig"
if gh run download --name "$MAC_SIG_ARTIFACT" -D /tmp/mac_sig 2>/dev/null; then
MAC_SIG=$(cat /tmp/mac_sig/*.sig)
echo "mac_signature=$MAC_SIG" >> $GITHUB_OUTPUT
echo "Found macOS signature: $MAC_SIG"
else
echo "No macOS signature artifact found"
fi
# For Windows, signature would come from WinSparkle signing (if implemented)
# echo "win_signature=$WIN_SIG" >> $GITHUB_OUTPUT
- name: Generate appcast.xml
run: |
python scripts/generate_appcast.py \
--version "${{ steps.version.outputs.version }}" \
--release-notes-url "${{ steps.assets.outputs.release_url }}" \
--mac-url "${{ steps.assets.outputs.mac_url }}" \
--mac-signature "${{ steps.signatures.outputs.mac_signature }}" \
--mac-length "${{ steps.assets.outputs.mac_size }}" \
--output appcast.xml
echo "Generated appcast.xml:"
cat appcast.xml
- name: Upload appcast artifact
uses: actions/upload-artifact@v4
with:
name: appcast
path: appcast.xml
# Deploy to Cloudflare KV (for check-version.orcaslicer.com Worker)
- name: Deploy appcast to Cloudflare KV
if: github.event_name == 'release'
env:
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
KV_NAMESPACE_ID: ${{ secrets.CF_KV_NAMESPACE_ID }}
run: |
if [ -n "$CF_API_TOKEN" ] && [ -n "$CF_ACCOUNT_ID" ] && [ -n "$KV_NAMESPACE_ID" ]; then
# Deploy appcast.xml
curl -X PUT \
"https://api.cloudflare.com/client/v4/accounts/$CF_ACCOUNT_ID/storage/kv/namespaces/$KV_NAMESPACE_ID/values/appcast.xml" \
-H "Authorization: Bearer $CF_API_TOKEN" \
-H "Content-Type: text/plain" \
--data-binary @appcast.xml
echo "Appcast deployed to Cloudflare KV"
# Deploy macOS signature file (for verification/auditing)
if [ -n "${{ steps.signatures.outputs.mac_signature }}" ]; then
echo "${{ steps.signatures.outputs.mac_signature }}" > mac_signature.txt
curl -X PUT \
"https://api.cloudflare.com/client/v4/accounts/$CF_ACCOUNT_ID/storage/kv/namespaces/$KV_NAMESPACE_ID/values/signatures/${{ steps.version.outputs.version }}/mac.sig" \
-H "Authorization: Bearer $CF_API_TOKEN" \
-H "Content-Type: text/plain" \
--data-binary @mac_signature.txt
echo "macOS signature deployed to Cloudflare KV"
fi
else
echo "Cloudflare credentials not configured, skipping deployment"
fi