Skip to content

Craft Anything: understand how any software works, and craft your own.

Rust

ci: switch CI/CD to craft-common-actions and add Flatpak OCI (#12)

Dylan M. Taylorbbe46663cc04
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 7dfb2e36..ae7a699e 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,102 +1,28 @@
-# CI for pull requests and main: format, clippy, tests, dependency layering, the tool list and
-# the wasm32 check (the same gates as `cargo xtask ci`). Linux only: macOS is built and tested only
-# by release.yml (the org's macOS runners are kept for releases; craftrules release/playbook.md),
-# and Windows/FreeBSD packaging have their own workflows.
name: CI
-# Every pull request and every push to main, once the repository is public (GitHub-hosted runners
-# are free for public repositories; while it's private, the jobs below are skipped unless started by
-# hand, so they cost nothing).
+# Quality gates for every push to main and every pull request (`cargo xtask ci`), through the
+# suite's shared gate workflow in craft-common-actions.
on:
- pull_request:
push:
branches: [main]
+ pull_request:
workflow_dispatch:
permissions:
contents: read
-env:
- CARGO_TERM_COLOR: always
- CARGO_INCREMENTAL: 0
- RUST_BACKTRACE: 1
- # Debug and test builds keep line tables (file:line in panic backtraces) but drop the rest of the
- # debug info: faster codegen and links, and a smaller target dir.
- CARGO_PROFILE_DEV_DEBUG: line-tables-only
-
-# A newer push to a PR branch cancels its older run. Runs on main are never cancelled, so every
-# main state that gets a run is checked to the end.
+# A newer push to a PR branch cancels its older run; every push to main runs to the end.
concurrency:
- group: ci-${{ github.ref }}
+ group: ci-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
- test:
- name: test (ubuntu-latest)
- if: github.event_name == 'workflow_dispatch' || !github.event.repository.private
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
-
- - name: Install Linux system dependencies (egui/winit/rfd)
- run: |
- sudo apt-get update
- sudo apt-get install -y --no-install-recommends \
- libxkbcommon-dev libwayland-dev libx11-dev libxrandr-dev libxi-dev \
- libgl1-mesa-dev libgtk-3-dev
-
- - uses: dtolnay/rust-toolchain@stable
- with:
- components: clippy, rustfmt
-
- # Only main saves caches; PRs restore main's, so PR caches don't evict main's.
- - uses: Swatinem/rust-cache@v2
- with:
- save-if: ${{ github.ref == 'refs/heads/main' }}
- cache-on-failure: true
-
- - name: Format
- run: cargo fmt --all -- --check
-
- - name: Clippy
- run: cargo clippy --workspace --all-targets --locked -- -D warnings
-
- # Every crate's tests run even when one fails, so one failure can't hide another.
- - name: Test
- run: cargo test --workspace --locked --no-fail-fast
-
- - name: Dependency layering
- run: cargo run --locked -q -p xtask -- layers
-
- - name: Session locks taken twice
- run: cargo run --locked -q -p xtask -- locks
-
- - name: Tool list
- run: cargo run --locked -q -p xtask -- tools --check
-
- - name: Generated schemas
- run: cargo run --locked -q -p xtask -- schemas --check
-
- # No keys, tokens, private keys or local paths in what would be committed.
- - name: Secret scan
- run: cargo run --locked -q -p xtask -- secrets
-
- wasm:
- name: wasm32 check
- if: github.event_name == 'workflow_dispatch' || !github.event.repository.private
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- - uses: dtolnay/rust-toolchain@stable
- with:
- targets: wasm32-unknown-unknown
- - uses: Swatinem/rust-cache@v2
- with:
- key: wasm32
- save-if: ${{ github.ref == 'refs/heads/main' }}
- cache-on-failure: true
- # The L0-L2 analysis crates and apps/craft-anything-web must keep compiling for the browser.
- - name: Check wasm-safe crates
- run: cargo run --locked -q -p xtask -- wasm
- - name: Check the web app
- run: cargo check --locked --target wasm32-unknown-unknown -p craft-anything-web
+ gate:
+ # Tracks @main so suite-wide CI fixes reach every app without a PR in each repository.
+ uses: storytold/craft-common-actions/.github/workflows/gate.yml@main
+ with:
+ # Same craft-fonts commit as release.yml.
+ craft-fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83
+ packages: >-
+ libxkbcommon-dev libwayland-dev libx11-dev libxrandr-dev libxi-dev libgl1-mesa-dev
+ libgtk-3-dev
diff --git a/.github/workflows/freebsd.yml b/.github/workflows/freebsd.yml
index 642d2545..537aafaa 100644
--- a/.github/workflows/freebsd.yml
+++ b/.github/workflows/freebsd.yml
@@ -1,19 +1,20 @@
# Builds and tests the workspace on FreeBSD, inside a FreeBSD VM on a Linux runner
-# (GitHub has no FreeBSD runners). The `package` job checks packaging/freebsd/package.sh (the
-# release job runs it for real), so a broken FreeBSD package fails here before it can fail a
-# release. Nothing is uploaded from the build job and no secrets are used.
+# (GitHub has no FreeBSD runners). GPU tests skip themselves when the VM has no adapter.
+# It then runs packaging/freebsd/package.sh, the script the release job runs, and checks the
+# tarball, so a broken FreeBSD package fails here before it can fail a release. Nothing is
+# uploaded and no secrets are used.
name: FreeBSD
-# Pushes to main, pull requests that touch FreeBSD packaging or dependencies, and by hand. While
-# the repository is private the jobs are skipped unless started by hand, so they cost nothing.
+# The VM build takes one to several hours, so it runs nightly on main rather than on every push
+# or dependency change: a drifted dependency still shows up within a day. PRs that change the
+# FreeBSD packaging itself still run it.
on:
push:
- branches: [main]
+ branches: [release]
+ schedule:
+ - cron: "17 2 * * *"
pull_request:
paths:
- - Cargo.toml
- - Cargo.lock
- - "**/Cargo.toml"
- .github/workflows/freebsd.yml
- packaging/freebsd/**
- packaging/env.sh
@@ -28,68 +29,8 @@ permissions:
jobs:
freebsd:
- name: FreeBSD 14 (build + test)
- if: github.event_name == 'workflow_dispatch' || !github.event.repository.private
- # A private repo's ubuntu-latest (2 vCPUs, 7 GB) is too small for this VM; the org's 16-core
- # larger runner fits it (craftrules learnings/ci-and-release.md).
- runs-on: github-ubuntu-16core
- timeout-minutes: 300
- steps:
- - uses: actions/checkout@v4
- - name: Build and test in a FreeBSD VM
- uses: vmactions/freebsd-vm@c46abacb49f09938ca4e1702d15d836285d694cc # v1
- with:
- release: "14.3"
- usesh: true
- cpu: 4
- mem: 12288
- # Nothing to bring back; copying the target dir out of the VM fails on large builds.
- copyback: false
- prepare: |
- pkg install -y git curl pkgconf cmake python3 libxkbcommon wayland libX11 libXcursor libXrandr libXi libxcb mesa-libs vulkan-loader gtk3 fontconfig freetype2
- curl -fsSL https://sh.rustup.rs | sh -s -- -y --profile minimal
- run: |
- set -e
- . "$HOME/.cargo/env"
- # The checkout is synced in under another owner; let tests that call git read it.
- git config --global --add safe.directory "*"
- rustc --version
- CARGO_PROFILE_DEV_DEBUG=0 cargo build --workspace --all-targets --locked
- CARGO_PROFILE_DEV_DEBUG=0 cargo test --workspace --locked
-
- package:
- name: FreeBSD 14 (package)
- # The release build takes a while: only for pull requests that touch FreeBSD packaging (or
- # dependencies) and on demand, not on every push to main.
- if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && !github.event.repository.private)
- runs-on: github-ubuntu-16core
- timeout-minutes: 150
- steps:
- - uses: actions/checkout@v4
- - name: Package in a FreeBSD VM
- uses: vmactions/freebsd-vm@c46abacb49f09938ca4e1702d15d836285d694cc # v1
- with:
- release: "14.3"
- usesh: true
- cpu: 4
- mem: 12288
- prepare: |
- pkg install -y bash curl git pkgconf cmake python3 libxkbcommon wayland libX11 libXcursor libXrandr libXi libxcb mesa-libs vulkan-loader gtk3 fontconfig freetype2
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable
- run: |
- set -e
- . "$HOME/.cargo/env"
- git config --global --add safe.directory "$PWD"
- # Build outside the checkout so only dist/ is copied back out of the VM.
- export CARGO_TARGET_DIR=/var/tmp/craft-anything-target CARGO_BUILD_JOBS=4
- bash packaging/freebsd/package.sh
- # Every part the package must have.
- tar -tzf dist/release/craft-anything-*-freebsd-x86_64.tar.gz >/var/tmp/contents.txt
- for want in '/bin/craft-anything$' '/bin/craft-anything-cli$' '/share/applications/ai\.storyteller\.craft-anything\.desktop$' '/share/icons/hicolor/' '/share/doc/craft-anything/LICENSE-MIT$' '/share/doc/craft-anything/NOTICE$'; do
- grep -Eq "$want" /var/tmp/contents.txt || { echo "missing from the package: $want"; exit 1; }
- done
- - uses: actions/upload-artifact@v4
- with:
- name: freebsd-package
- path: dist/release/*
- if-no-files-found: error
+ # Intentionally tracked at @main (not SHA-pinned) so org-wide CI improvements, security fixes, and build optimizations propagate without PR churn across all craftapp repos.
+ uses: storytold/craft-common-actions/.github/workflows/freebsd.yml@main
+ with:
+ craft-fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83
+ run-package-check: true
diff --git a/.github/workflows/packaging-lint.yml b/.github/workflows/packaging-lint.yml
index 162a3443..f54b0538 100644
--- a/.github/workflows/packaging-lint.yml
+++ b/.github/workflows/packaging-lint.yml
@@ -2,8 +2,12 @@
# packaging shell/PowerShell scripts, and the Linux desktop/AppStream/Flatpak metadata.
name: Packaging lint
-# enable on PRs when M4 starts (docs/ROADMAP.md)
on:
+ push:
+ branches: [main, release]
+ paths: [".github/workflows/**", "packaging/**", "assets/app-icon/**"]
+ pull_request:
+ paths: [".github/workflows/**", "packaging/**", "assets/app-icon/**"]
workflow_dispatch:
permissions:
@@ -15,56 +19,5 @@ concurrency:
jobs:
lint:
- runs-on: ubuntu-latest
- env:
- ACTIONLINT_VERSION: 1.7.12
- steps:
- - uses: actions/checkout@v4
- - name: Install tools
- run: |
- sudo apt-get update
- sudo apt-get install -y --no-install-recommends shellcheck desktop-file-utils appstream libxml2-utils python3-yaml
- curl -fsSL "https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/actionlint_${ACTIONLINT_VERSION}_linux_amd64.tar.gz" \
- | tar -xz -C "$RUNNER_TEMP" actionlint
- - name: actionlint
- run: |
- "$RUNNER_TEMP/actionlint" -color
- - name: shellcheck
- run: shellcheck packaging/*.sh packaging/*/*.sh packaging/linux/AppRun
- - name: AppImage AppRun desktop integration
- run: bash packaging/linux/apprun-test.sh
- - name: PowerShell
- shell: pwsh
- run: |
- foreach ($f in Get-ChildItem packaging/windows/*.ps1) {
- $errors = $null
- [System.Management.Automation.Language.Parser]::ParseFile($f.FullName, [ref]$null, [ref]$errors) | Out-Null
- if ($errors) { $errors | ForEach-Object { Write-Output "::error file=$($f.Name)::$_" }; exit 1 }
- Write-Output "ok $($f.Name)"
- }
- ./packaging/windows/check-icons.ps1
- - name: FreeBSD package layout (dry run, no build)
- run: bash packaging/freebsd/package.sh --dry-run
- - name: Package metadata names only this app
- run: |
- other=$(grep -rhoiIE '[a-z]*craft[a-z_-]*' packaging/ .github/ | tr '[:upper:]' '[:lower:]' | grep -vE '^(craft|artcraft|getartcraft|craftrules|launchcraftanything|craft[-_]?anything.*)$' | sort -u)
- if [ -n "$other" ]; then
- echo "::error::package metadata names another app: $other"
- exit 1
- fi
- - name: XML, desktop entry, AppStream, Flatpak manifest
- run: |
- xmllint --noout packaging/windows/craft-anything.wxs packaging/windows/craft-anything.en-us.wxl packaging/macos/*.plist* packaging/linux/*.xml*
- desktop-file-validate packaging/linux/ai.storyteller.craft-anything.desktop
- sed -e 's/@VERSION@/0.0.0/' -e 's/@DATE@/2026-01-01/' packaging/linux/ai.storyteller.craft-anything.metainfo.xml.in >"$RUNNER_TEMP/ai.storyteller.craft-anything.metainfo.xml"
- appstreamcli validate --no-net --explain "$RUNNER_TEMP/ai.storyteller.craft-anything.metainfo.xml"
- python3 - <<'EOF'
- import yaml
- src = yaml.safe_load(open("packaging/linux/flatpak/ai.storyteller.craft-anything.yml"))
- bundle = yaml.safe_load(open("packaging/linux/flatpak/ai.storyteller.craft-anything.bundle.yml"))
- for m in (src, bundle):
- assert m["id"] == "ai.storyteller.craft-anything" and m["command"] == "craft-anything", m["id"]
- for key in ("runtime", "runtime-version", "sdk", "finish-args"):
- assert src[key] == bundle[key], f"Flatpak manifests disagree on {key}: {src[key]} vs {bundle[key]}"
- print("Flatpak manifests ok")
- EOF
+ # Intentionally tracked at @main (not SHA-pinned) so org-wide CI improvements, security fixes, and build optimizations propagate without PR churn across all craftapp repos.
+ uses: storytold/craft-common-actions/.github/workflows/packaging-lint.yml@main
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 0bc58a92..01346b6c 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,11 +1,3 @@
-# Release pipeline: every push to `release` builds signed installers for every platform and
-# creates or updates the draft GitHub Release "Craft Anything v<version>". See docs/releasing.md.
-#
-# Only the jobs that read secrets (macOS and Windows signing, and the draft release) run in the
-# `release` environment (restricted to the `release` branch), which holds the signing secrets; the
-# rest build on any branch, so `gh workflow run release.yml --ref <branch>` is a real dry run.
-# Every secret is optional: missing ones produce unsigned artifacts and a warning, never a failed
-# build. Playbook: storytold/craftrules release/playbook.md.
name: Release
on:
@@ -19,439 +11,34 @@ on:
default: ""
permissions:
- contents: read
+ contents: write
+ packages: write
concurrency:
group: release-${{ github.ref }}
- # Never cancel a run mid-notarization or mid-upload; a newer push waits its turn.
cancel-in-progress: false
-env:
- CARGO_TERM_COLOR: always
- CARGO_INCREMENTAL: 0
- RUST_BACKTRACE: 1
- CRAFT_ANYTHING_BUILD_SHA: ${{ github.sha }}
- INPUT_VERSION: ${{ inputs.version }}
-
jobs:
- version:
- name: version
- runs-on: ubuntu-latest
- # No `environment: release`: this job reads no secrets, so a branch dry run can run it.
- outputs:
- version: ${{ steps.v.outputs.version }}
- date: ${{ steps.v.outputs.date }}
- prerelease: ${{ steps.v.outputs.prerelease }}
- steps:
- - uses: actions/checkout@v4
- - id: v
- name: Resolve version
- run: |
- . packaging/env.sh
- v="${INPUT_VERSION#v}"
- v="${v:-$VERSION}"
- if ! printf '%s' "$v" | grep -Eq '^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$'; then
- echo "::error::'$v' is not a version like 1.2.3 or 1.2.3-rc.1"
- exit 1
- fi
- case "$v" in *-*) pre=true ;; *) pre=false ;; esac
- {
- echo "version=$v"
- echo "date=$(date -u +%Y-%m-%d)"
- echo "prerelease=$pre"
- } >>"$GITHUB_OUTPUT"
- echo "### Craft Anything v$v (\`${GITHUB_SHA::9}\`)" >>"$GITHUB_STEP_SUMMARY"
-
- macos:
- name: macOS universal
- needs: version
- runs-on: macos-15-xlarge # M2 Pro larger runner; use only in release.yml (actions_macos_xl budget caps spend)
- environment: release
- env:
- CRAFT_ANYTHING_VERSION: ${{ needs.version.outputs.version }}
- CRAFT_ANYTHING_BUILD_DATE: ${{ needs.version.outputs.date }}
- steps:
- - uses: actions/checkout@v4
- - uses: dtolnay/rust-toolchain@stable
- with:
- targets: aarch64-apple-darwin, x86_64-apple-darwin
- - uses: Swatinem/rust-cache@v2
- with:
- key: release-macos-universal
- - name: Apply version override
- if: inputs.version != ''
- run: cargo run --locked -q -p xtask -- version set "$CRAFT_ANYTHING_VERSION"
- - name: Import signing certificate
- env:
- APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
- APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
- KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
- run: packaging/macos/import-cert.sh
- - name: Build, sign, notarize
- env:
- APPLE_ID: ${{ secrets.APPLE_ID }}
- APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
- APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
- run: packaging/macos/package.sh --arch universal
- # Unpacks the CLI zip and checks the binary users get: Developer ID, hardened runtime,
- # timestamp, and Gatekeeper's notarization lookup (codesign --verify, spctl). Also the DMG's
- # stapled ticket. Strict when the signing secrets are present, warnings otherwise.
- - name: Verify signatures and notarization
- env:
- APPLE_ID: ${{ secrets.APPLE_ID }}
- APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
- APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
- run: packaging/macos/verify.sh --arch universal
- - uses: actions/upload-artifact@v4
- with:
- name: release-macos
- path: dist/release/*
- if-no-files-found: error
- - name: Remove temporary keychain
- if: always()
- run: |
- if [ -n "${MACOS_KEYCHAIN:-}" ]; then security delete-keychain "$MACOS_KEYCHAIN" || true; fi
-
- windows:
- name: Windows ${{ matrix.arch }}
- needs: version
- runs-on: windows-latest
- environment: release
- strategy:
- fail-fast: false
- matrix:
- include:
- - { arch: x64, target: x86_64-pc-windows-msvc }
- - { arch: x86, target: i686-pc-windows-msvc }
- # Windows on ARM: cross-compiled on the x64 runner, so signing and WiX run as above.
- # .github/workflows/windows-arm64.yml installs and runs it on ARM64 hardware.
- - { arch: arm64, target: aarch64-pc-windows-msvc }
- env:
- CRAFT_ANYTHING_VERSION: ${{ needs.version.outputs.version }}
- CRAFT_ANYTHING_BUILD_DATE: ${{ needs.version.outputs.date }}
- steps:
- - uses: actions/checkout@v4
- - uses: dtolnay/rust-toolchain@stable
- with:
- targets: ${{ matrix.target }}
- - uses: Swatinem/rust-cache@v2
- with:
- key: release-windows-${{ matrix.arch }}
- - name: Apply version override
- if: inputs.version != ''
- shell: bash
- run: cargo run --locked -q -p xtask -- version set "$CRAFT_ANYTHING_VERSION"
- - name: Install WiX
- shell: pwsh
- run: |
- dotnet tool install --global wix --version 5.0.2
- wix extension add -g WixToolset.UI.wixext/5.0.2 WixToolset.Util.wixext/5.0.2
- - name: Build, sign, package
- shell: pwsh
- env:
- WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }}
- WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
- AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
- AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
- AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
- AZURE_SIGNING_ENDPOINT: ${{ secrets.AZURE_SIGNING_ENDPOINT }}
- AZURE_SIGNING_ACCOUNT: ${{ secrets.AZURE_SIGNING_ACCOUNT }}
- AZURE_CERT_PROFILE: ${{ secrets.AZURE_CERT_PROFILE }}
- # The exe must carry its icon and VERSIONINFO (apps/craft-anything/build.rs).
- CRAFT_ANYTHING_REQUIRE_WINRES: "1"
- run: ./packaging/windows/package.ps1 -Arch ${{ matrix.arch }}
- - uses: actions/upload-artifact@v4
- with:
- name: release-windows-${{ matrix.arch }}
- path: dist/release/*
- if-no-files-found: error
-
- linux:
- name: Linux ${{ matrix.arch }}
- needs: version
- # The oldest GitHub-hosted image, so the binaries only need glibc >= 2.35 (Ubuntu 22.04+,
- # Debian 12+, Fedora 36+, RHEL 10). See docs/releasing.md.
- runs-on: ${{ matrix.runner }}
- # No `environment: release`: this job reads no secrets, so a branch dry run can run it.
- strategy:
- fail-fast: false
- matrix:
- include:
- - { arch: x86_64, runner: ubuntu-22.04, deb: amd64 }
- - { arch: aarch64, runner: ubuntu-22.04-arm, deb: arm64 }
- env:
- CRAFT_ANYTHING_VERSION: ${{ needs.version.outputs.version }}
- CRAFT_ANYTHING_BUILD_DATE: ${{ needs.version.outputs.date }}
- NFPM_VERSION: 2.47.0
- steps:
- - uses: actions/checkout@v4
- - name: Install build and packaging tools
- run: |
- sudo apt-get update
- sudo apt-get install -y --no-install-recommends \
- libxkbcommon-dev libwayland-dev libx11-dev libxrandr-dev libxi-dev libgl1-mesa-dev \
- desktop-file-utils appstream python3-yaml zsync
- curl -fsSL -o "$RUNNER_TEMP/nfpm.deb" \
- "https://github.com/goreleaser/nfpm/releases/download/v${NFPM_VERSION}/nfpm_${NFPM_VERSION}_${{ matrix.deb }}.deb"
- sudo dpkg -i "$RUNNER_TEMP/nfpm.deb"
- - uses: dtolnay/rust-toolchain@stable
- - uses: Swatinem/rust-cache@v2
- with:
- key: release-linux-${{ matrix.arch }}
- - name: Apply version override
- if: inputs.version != ''
- run: cargo run --locked -q -p xtask -- version set "$CRAFT_ANYTHING_VERSION"
- - name: Build and package (AppImage, deb, rpm, tar.gz)
- run: packaging/linux/package.sh
- - name: Check the packages
- run: |
- dpkg-deb --info dist/release/*.deb
- dpkg-deb --contents dist/release/*.deb | grep -E 'usr/bin/craft-anything$|metainfo|applications'
- ldd target/release/craft-anything
- python3 -c "import yaml; m = yaml.safe_load(open('packaging/linux/flatpak/ai.storyteller.craft-anything.yml')); assert m['id'] == 'ai.storyteller.craft-anything'"
- for appimage in dist/release/*.AppImage; do
- chmod +x "$appimage"
- APPIMAGE_EXTRACT_AND_RUN=1 "$appimage" --version
- # Update information is embedded, and the .zsync for delta updates sits beside it.
- "$appimage" --appimage-updateinformation | grep -F 'gh-releases-zsync|'
- test -s "$appimage.zsync"
- done
- - uses: actions/upload-artifact@v4
- with:
- name: release-linux-${{ matrix.arch }}
- path: dist/release/*
- if-no-files-found: error
-
- flatpak:
- name: Flatpak ${{ matrix.arch }}
- needs: [version, linux]
- # Repackages the Linux job's tarball (the same binaries as the AppImage/deb/rpm); no Rust
- # build here. 24.04 for a newer flatpak-builder (1.4) than 22.04 ships.
- runs-on: ${{ matrix.runner }}
- # No `environment: release`: this job signs nothing, so it gets no release secrets.
- strategy:
- fail-fast: false
- matrix:
- include:
- - { arch: x86_64, runner: ubuntu-24.04 }
- - { arch: aarch64, runner: ubuntu-24.04-arm }
- env:
- CRAFT_ANYTHING_VERSION: ${{ needs.version.outputs.version }}
- CRAFT_ANYTHING_BUILD_DATE: ${{ needs.version.outputs.date }}
- steps:
- - uses: actions/checkout@v4
- - uses: actions/download-artifact@v4
- with:
- name: release-linux-${{ matrix.arch }}
- path: dist/linux
- - name: Install flatpak-builder
- run: |
- sudo apt-get update
- # librsvg2-common: the SVG pixbuf loader. flatpak-builder runs the host's
- # `appstreamcli compose`, which renders the scalable icon and fails without it.
- sudo apt-get install -y --no-install-recommends flatpak flatpak-builder librsvg2-common
- # Ubuntu 24.04's AppArmor blocks the unprivileged user namespaces bubblewrap needs.
- sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
- - name: Build the Flatpak bundle
- run: packaging/linux/flatpak-bundle.sh "dist/linux/craft-anything-$CRAFT_ANYTHING_VERSION-linux-${{ matrix.arch }}.tar.gz"
- - uses: actions/upload-artifact@v4
- with:
- name: release-flatpak-${{ matrix.arch }}
- path: dist/release/*.flatpak
- if-no-files-found: error
-
- freebsd:
- name: FreeBSD x86_64
- needs: version
- # GitHub has no FreeBSD runners: build in a FreeBSD 14.3 VM, the same image and packages as
- # .github/workflows/freebsd.yml. A private repo's ubuntu-latest has 2 vCPUs and 7 GB, too small
- # for this VM (QEMU "cannot set up guest memory"), so it runs on the org's 16-core larger runner.
- runs-on: github-ubuntu-16core
- timeout-minutes: 180
- # No `environment: release`: this job signs nothing, so it gets no release secrets.
- env:
- CRAFT_ANYTHING_VERSION: ${{ needs.version.outputs.version }}
- CRAFT_ANYTHING_BUILD_DATE: ${{ needs.version.outputs.date }}
- steps:
- - uses: actions/checkout@v4
- - uses: dtolnay/rust-toolchain@stable
- if: inputs.version != ''
- - name: Apply version override
- if: inputs.version != ''
- run: cargo run --locked -q -p xtask -- version set "$CRAFT_ANYTHING_VERSION"
- - name: Build and package in a FreeBSD VM (tar.gz)
- # vmactions/freebsd-vm v1.5.9, pinned by commit (it runs our build).
- uses: vmactions/freebsd-vm@c46abacb49f09938ca4e1702d15d836285d694cc
- with:
- release: "14.3"
- usesh: true
- cpu: 4
- mem: 12288
- # Passed into the VM by name; never templated into the script below.
- envs: "CRAFT_ANYTHING_VERSION CRAFT_ANYTHING_BUILD_DATE CRAFT_ANYTHING_BUILD_SHA"
- # The FreeBSD CI packages, plus bash for the packaging script.
- prepare: |
- pkg install -y bash git curl pkgconf cmake python3 libxkbcommon wayland libX11 libXcursor libXrandr libXi libxcb mesa-libs vulkan-loader gtk3 fontconfig freetype2
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable
- run: |
- set -e
- . "$HOME/.cargo/env"
- git config --global --add safe.directory "$PWD"
- # Build outside the checkout so only dist/ is copied back out of the VM (copying the
- # target dir back fails on large builds). 4 jobs: more runs the VM out of memory.
- export CARGO_TARGET_DIR=/var/tmp/craft-anything-target CARGO_BUILD_JOBS=4
- bash packaging/freebsd/package.sh
- # Every part the package must have.
- tar -tzf dist/release/craft-anything-*-freebsd-x86_64.tar.gz >"$HOME/freebsd-contents.txt"
- for want in '/bin/craft-anything$' '/bin/craft-anything-cli$' '/share/applications/ai\.storyteller\.craft-anything\.desktop$' '/share/icons/hicolor/' '/share/doc/craft-anything/LICENSE-MIT$' '/share/doc/craft-anything/NOTICE$'; do
- grep -Eq "$want" "$HOME/freebsd-contents.txt" || { echo "missing from the package: $want"; exit 1; }
- done
- - uses: actions/upload-artifact@v4
- with:
- name: release-freebsd-x86_64
- path: dist/release/*
- if-no-files-found: error
-
- web:
- name: Web (wasm)
- needs: version
- runs-on: ubuntu-latest
- # No `environment: release`: this job reads no secrets, so a branch dry run can run it.
- env:
- CRAFT_ANYTHING_VERSION: ${{ needs.version.outputs.version }}
- CRAFT_ANYTHING_BUILD_DATE: ${{ needs.version.outputs.date }}
- TRUNK_VERSION: 0.21.14
- steps:
- - uses: actions/checkout@v4
- - uses: dtolnay/rust-toolchain@stable
- with:
- targets: wasm32-unknown-unknown
- - uses: Swatinem/rust-cache@v2
- with:
- key: release-web
- - name: Install trunk
- run: |
- curl -fsSL "https://github.com/trunk-rs/trunk/releases/download/v${TRUNK_VERSION}/trunk-x86_64-unknown-linux-gnu.tar.gz" \
- | tar -xz -C "$HOME/.cargo/bin" trunk
- trunk --version
- - name: Apply version override
- if: inputs.version != ''
- run: cargo run --locked -q -p xtask -- version set "$CRAFT_ANYTHING_VERSION"
- - name: Build and zip
- run: packaging/web/package.sh
- - uses: actions/upload-artifact@v4
- with:
- name: release-web
- path: dist/release/*
- if-no-files-found: error
-
- linux-riscv64:
- name: Linux riscv64
- needs: version
- # Cross-compiled on x86_64 (no hosted RISC-V runners) against the runner's own Ubuntu release
- # from ports.ubuntu.com, so the binaries need that release's glibc (24.04: 2.39). 22.04's
- # riscv64 ports lag its amd64 updates, which breaks the multiarch install. tar.gz only; the
- # CLI is smoke-tested under QEMU.
- runs-on: ubuntu-24.04
- # No `environment: release`: this job reads no secrets, so a branch dry run can run it.
- env:
- CRAFT_ANYTHING_VERSION: ${{ needs.version.outputs.version }}
- CRAFT_ANYTHING_BUILD_DATE: ${{ needs.version.outputs.date }}
- steps:
- - uses: actions/checkout@v4
- - uses: dtolnay/rust-toolchain@stable
- with:
- targets: riscv64gc-unknown-linux-gnu
- - uses: Swatinem/rust-cache@v2
- with:
- key: release-linux-riscv64
- - name: Apply version override
- if: inputs.version != ''
- run: cargo run --locked -q -p xtask -- version set "$CRAFT_ANYTHING_VERSION"
- - name: Install cross-compilation dependencies
- run: |
- . /etc/os-release
- sudo dpkg --add-architecture riscv64
- # Pin the existing (archive.ubuntu.com) sources to amd64; riscv64 comes from ports.
- if [ -f /etc/apt/sources.list.d/ubuntu.sources ]; then
- sudo sed -i '/^Types: deb/a Architectures: amd64' /etc/apt/sources.list.d/ubuntu.sources
- fi
- if [ -f /etc/apt/sources.list ]; then
- sudo sed -i 's/^deb /deb [arch=amd64] /g' /etc/apt/sources.list
- sudo sed -i 's/^deb-src /deb-src [arch=amd64] /g' /etc/apt/sources.list
- fi
- for suite in "$VERSION_CODENAME" "$VERSION_CODENAME-updates" "$VERSION_CODENAME-security"; do
- echo "deb [arch=riscv64] http://ports.ubuntu.com/ubuntu-ports $suite main universe restricted multiverse"
- done | sudo tee /etc/apt/sources.list.d/riscv64.list
- sudo apt-get update
- sudo apt-get install -y --no-install-recommends \
- gcc-riscv64-linux-gnu binutils-riscv64-linux-gnu libc6-dev-riscv64-cross libc6-dev:riscv64 qemu-user \
- libxkbcommon-dev:riscv64 libwayland-dev:riscv64 libx11-dev:riscv64 libxrandr-dev:riscv64 \
- libxi-dev:riscv64 libgl1-mesa-dev:riscv64
- - name: Build and package (tar.gz)
- env:
- CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_LINKER: riscv64-linux-gnu-gcc
- PKG_CONFIG_SYSROOT_DIR: /
- PKG_CONFIG_PATH: /usr/lib/riscv64-linux-gnu/pkgconfig:/usr/share/pkgconfig
- PKG_CONFIG_ALLOW_CROSS: "1"
- CROSS_ARCH: riscv64
- CROSS_TARGET: riscv64gc-unknown-linux-gnu
- CROSS_COMPILE: riscv64-linux-gnu-
- EMULATOR: qemu-riscv64
- QEMU_LD_PREFIX: /usr/riscv64-linux-gnu
- run: packaging/linux/package.sh --formats tar
- - uses: actions/upload-artifact@v4
- with:
- name: release-linux-riscv64
- path: dist/release/*.tar.gz
- if-no-files-found: error
-
release:
- name: Draft GitHub Release
- needs: [version, macos, windows, linux, linux-riscv64, flatpak, freebsd, web]
- runs-on: ubuntu-latest
- environment: release
- permissions:
- contents: write
- env:
- VERSION: ${{ needs.version.outputs.version }}
- PRERELEASE: ${{ needs.version.outputs.prerelease }}
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- GH_REPO: ${{ github.repository }}
- steps:
- - uses: actions/download-artifact@v4
- with:
- pattern: release-*
- path: artifacts
- merge-multiple: true
- - name: Checksums
- working-directory: artifacts
- run: |
- sha256sum -- * | tee SHA256SUMS.txt
- - name: Create or update the draft release
- working-directory: artifacts
- run: |
- tag="v$VERSION"
- title="Craft Anything v$VERSION"
- pre=()
- if [ "$PRERELEASE" = true ]; then pre=(--prerelease); fi
- if draft="$(gh release view "$tag" --json isDraft --jq .isDraft 2>/dev/null)"; then
- if [ "$draft" != "true" ]; then
- echo "::error::Release $tag is already published. Bump the version (cargo run -p xtask -- version set X.Y.Z) before pushing to release."
- exit 1
- fi
- echo "Updating draft $tag: replacing its assets"
- gh release view "$tag" --json assets --jq '.assets[].name' | while read -r asset; do
- gh release delete-asset "$tag" "$asset" --yes
- done
- gh release edit "$tag" --draft --title "$title" --target "$GITHUB_SHA" --prerelease="$PRERELEASE"
- gh release upload "$tag" --clobber -- *
- else
- echo "Creating draft $tag"
- gh release create "$tag" --draft --title "$title" --target "$GITHUB_SHA" --generate-notes "${pre[@]}" -- *
- fi
- {
- echo "Draft release **$title** at \`${GITHUB_SHA::9}\`:"
- echo
- sed 's/^/ /' SHA256SUMS.txt
- } >>"$GITHUB_STEP_SUMMARY"
+ # Intentionally tracked at @main (not SHA-pinned) so org-wide CI improvements, security fixes, and build optimizations propagate without PR churn across all craftapp repos.
+ uses: storytold/craft-common-actions/.github/workflows/release.yml@main
+ with:
+ app-name: craft-anything
+ app-title: "Craft Anything"
+ craft-fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83
+ version: ${{ inputs.version }}
+ secrets:
+ APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
+ APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
+ KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
+ APPLE_ID: ${{ secrets.APPLE_ID }}
+ APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
+ APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
+ WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }}
+ WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
+ AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
+ AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
+ AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
+ AZURE_SIGNING_ENDPOINT: ${{ secrets.AZURE_SIGNING_ENDPOINT }}
+ AZURE_SIGNING_ACCOUNT: ${{ secrets.AZURE_SIGNING_ACCOUNT }}
+ AZURE_CERT_PROFILE: ${{ secrets.AZURE_CERT_PROFILE }}
diff --git a/.github/workflows/windows-arm64.yml b/.github/workflows/windows-arm64.yml
index d0a88d72..7c11db1c 100644
--- a/.github/workflows/windows-arm64.yml
+++ b/.github/workflows/windows-arm64.yml
@@ -1,11 +1,18 @@
# Windows on ARM: package the ARM64 release the way release.yml does (cross-compiled on an x64
# runner, unsigned here), then install that MSI on a Windows 11 ARM64 runner, check the installed
# binaries are ARM64, run the CLI natively, and uninstall. (A native ARM64 `cargo test` job is left
-# out for now: egui UI tests have hit an intermittent access violation there.)
+# out for now: PdfCraft saw an intermittent access violation in egui UI tests there.)
name: Windows ARM64
-# enable on PRs when M4 starts (docs/ROADMAP.md)
+# Nightly on main (dependency and runner-image drift shows up within a day), and on PRs that
+# change the Windows packaging itself.
on:
+ pull_request:
+ paths:
+ - .github/workflows/windows-arm64.yml
+ - packaging/windows/**
+ schedule:
+ - cron: "41 4 * * *"
workflow_dispatch:
concurrency:
@@ -15,72 +22,10 @@ concurrency:
permissions:
contents: read
-env:
- CARGO_TERM_COLOR: always
- CARGO_INCREMENTAL: 0
-
jobs:
- package:
- name: package (cross-compiled on x64)
- runs-on: windows-latest
- timeout-minutes: 90
- steps:
- - uses: actions/checkout@v4
- - uses: dtolnay/rust-toolchain@89b12181fb390509a0842a86cc55eeb8eb928c1d # stable
- with:
- targets: aarch64-pc-windows-msvc
- - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2
- with:
- key: windows-arm64-package
- - name: Install WiX
- shell: pwsh
- run: |
- dotnet tool install --global wix --version 5.0.2
- wix extension add -g WixToolset.UI.wixext/5.0.2 WixToolset.Util.wixext/5.0.2
- - name: Build and package (unsigned)
- shell: pwsh
- env:
- DIST: ${{ github.workspace }}\dist\arm64
- run: ./packaging/windows/package.ps1 -Arch arm64
- - uses: actions/upload-artifact@v4
- with:
- name: craft-anything-windows-arm64
- path: dist/arm64/*
- if-no-files-found: error
- retention-days: 7
-
- install:
- name: install and run on ARM64
- needs: package
- runs-on: windows-11-arm
- timeout-minutes: 30
- steps:
- - uses: actions/download-artifact@v4
- with:
- name: craft-anything-windows-arm64
- path: dist
- - name: Install the MSI, check it, run it, uninstall it
- shell: pwsh
- run: |
- $ErrorActionPreference = 'Stop'
- $msi = (Get-ChildItem dist/*.msi | Select-Object -First 1).FullName
- $p = Start-Process msiexec.exe -ArgumentList '/i', "`"$msi`"", '/qn', '/l*v', 'install.log' -Wait -PassThru
- if ($p.ExitCode -ne 0) { Get-Content install.log -Tail 60; throw "msiexec /i exited $($p.ExitCode)" }
- $dir = Join-Path $env:ProgramFiles 'Craft Anything'
- foreach ($exe in 'craft-anything.exe', 'craft-anything-cli.exe') {
- $path = Join-Path $dir $exe
- if (-not (Test-Path $path)) { throw "$exe not installed in $dir" }
- $bytes = [System.IO.File]::ReadAllBytes($path)
- $machine = [BitConverter]::ToUInt16($bytes, [BitConverter]::ToInt32($bytes, 0x3C) + 4)
- if ($machine -ne 0xAA64) { throw "$exe is for machine 0x$('{0:X}' -f $machine), not ARM64" }
- Write-Output "ok $path (ARM64)"
- }
- # The installed CLI runs natively on ARM64.
- $cli = Join-Path $dir 'craft-anything-cli.exe'
- $out = & $cli --version 2>&1 | Out-String
- if ($LASTEXITCODE -ne 0) { Write-Output $out; throw "$cli --version exited $LASTEXITCODE" }
- Write-Output "ok $(Split-Path -Leaf $cli) --version: $($out.Trim())"
- $p = Start-Process msiexec.exe -ArgumentList '/x', "`"$msi`"", '/qn' -Wait -PassThru
- if ($p.ExitCode -ne 0) { throw "msiexec /x exited $($p.ExitCode)" }
- if (Test-Path (Join-Path $dir 'craft-anything.exe')) { throw 'uninstall left craft-anything.exe behind' }
- Write-Output 'ok uninstalled'
+ windows-arm64:
+ # Intentionally tracked at @main (not SHA-pinned) so org-wide CI improvements, security fixes, and build optimizations propagate without PR churn across all craftapp repos.
+ uses: storytold/craft-common-actions/.github/workflows/windows-arm64.yml@main
+ with:
+ app-name: craft-anything
+ app-dir: "Craft Anything"
diff --git a/packaging/freebsd/package.sh b/packaging/freebsd/package.sh
index 4a76d99c..8d5a4bc3 100755
--- a/packaging/freebsd/package.sh
+++ b/packaging/freebsd/package.sh
@@ -31,12 +31,29 @@ while [ $# -gt 0 ]; do
done
# FreeBSD's uname says amd64; release file names use x86_64 like the Linux and Windows ones.
+# CARGO_BUILD_TARGET is set when the release VM cross-compiles aarch64 from an x86_64 guest.
MACHINE="$(uname -m)"
case "$MACHINE" in
- amd64 | x86_64) ARCH=x86_64 ;;
- arm64 | aarch64) ARCH=aarch64 ;;
+ amd64 | x86_64) HOST_ARCH=x86_64 ;;
+ arm64 | aarch64) HOST_ARCH=aarch64 ;;
*) echo "unsupported architecture $MACHINE" >&2; exit 2 ;;
esac
+ARCH="$HOST_ARCH"
+if [[ -n "${CARGO_BUILD_TARGET:-}" ]]; then
+ # cargo's host-tuple alias means the host triple; resolve it so the binary dir matches cargo's output.
+ if [[ "$CARGO_BUILD_TARGET" = host-tuple ]]; then
+ CARGO_BUILD_TARGET="$(rustc -vV | sed -n 's/^host: //p')"
+ export CARGO_BUILD_TARGET
+ fi
+ case "$CARGO_BUILD_TARGET" in
+ aarch64-unknown-freebsd) ARCH=aarch64 ;;
+ x86_64-unknown-freebsd) ARCH=x86_64 ;;
+ *)
+ echo "error: unsupported CARGO_BUILD_TARGET $CARGO_BUILD_TARGET (use x86_64-unknown-freebsd or aarch64-unknown-freebsd)" >&2
+ exit 2
+ ;;
+ esac
+fi
if [ "$DRY_RUN" = 0 ] && [ "$(uname -s)" != FreeBSD ]; then
echo "error: build on FreeBSD (or pass --dry-run to check the tree layout)" >&2
exit 2
@@ -56,6 +73,7 @@ rm -rf "$WORK"
mkdir -p "$WORK"
BIN="$CARGO_TARGET_DIR/release"
+if [[ -n "${CARGO_BUILD_TARGET:-}" ]]; then BIN="$CARGO_TARGET_DIR/$CARGO_BUILD_TARGET/release"; fi
OUT_DIR="$DIST"
if [ "$DRY_RUN" = 1 ]; then
# Stub binaries, and the tarball stays in the work dir so dist/ only ever holds real builds.
@@ -95,7 +113,11 @@ mkdir -p "$OUT_DIR"
tar -C "$WORK" -czf "$OUT_DIR/$BASENAME.tar.gz" "$BASENAME"
echo "wrote $OUT_DIR/$BASENAME.tar.gz"
-"$STAGE/bin/$(smoke_bin)" --version
+if [[ -n "${CARGO_BUILD_TARGET:-}" ]]; then
+ echo "==> skipping $(smoke_bin) --version: CARGO_BUILD_TARGET is set, so the binary is not run on this host"
+else
+ "$STAGE/bin/$(smoke_bin)" --version
+fi
if [ "$DRY_RUN" = 1 ]; then
echo "==> dry run: tarball contents"
tar -tzvf "$OUT_DIR/$BASENAME.tar.gz"
diff --git a/packaging/linux/flatpak-bundle.sh b/packaging/linux/flatpak-bundle.sh
index 8843de83..277349a3 100755
--- a/packaging/linux/flatpak-bundle.sh
+++ b/packaging/linux/flatpak-bundle.sh
@@ -21,10 +21,12 @@ APP_ID=ai.storyteller.craft-anything
FLATHUB=https://dl.flathub.org/repo/flathub.flatpakrepo
TEST=1
+OCI=0
TARBALL=""
while [ $# -gt 0 ]; do
case "$1" in
--no-test) TEST=0; shift ;;
+ --oci) OCI=1; shift ;;
-h | --help) sed -n '2,14p' "$0"; exit 0 ;;
-*) echo "unknown argument: $1" >&2; exit 2 ;;
*) TARBALL="$1"; shift ;;
@@ -62,6 +64,12 @@ OUT="$DIST/$BASENAME.flatpak"
# --runtime-repo lets `flatpak install` fetch the freedesktop runtime from Flathub if missing.
flatpak build-bundle --runtime-repo="$FLATHUB" "$WORK/repo" "$OUT" "$APP_ID" stable
echo "wrote $OUT"
+if [[ "$OCI" = 1 ]]; then
+ OUT_OCI="$DIST/$BASENAME-oci"
+ rm -rf "$OUT_OCI"
+ flatpak build-bundle --oci "$WORK/repo" "$OUT_OCI" "$APP_ID" stable
+ echo "wrote OCI layout to $OUT_OCI"
+fi
if [ "$TEST" = 1 ]; then
flatpak install --user -y --noninteractive --reinstall "$OUT"
diff --git a/packaging/linux/flatpak-oci.sh b/packaging/linux/flatpak-oci.sh
new file mode 100755
index 00000000..d6f61d75
--- /dev/null
+++ b/packaging/linux/flatpak-oci.sh
@@ -0,0 +1,64 @@
+#!/usr/bin/env bash
+# Build craft-anything as an OCI container layout and push it to GitHub Container Registry (GHCR)
+# for consumption by Flatpak OCI clients (flatpak-oci-specs).
+#
+# Usage:
+# packaging/linux/flatpak-oci.sh [--push] [TARBALL]
+#
+# Environment variables:
+# REGISTRY Target registry image (default: ghcr.io/storytold/craft-anything)
+# TAG Target image tag (default: $VERSION-$ARCH, also tags stable-$ARCH)
+# GITHUB_TOKEN Token for GHCR authentication when --push is used
+set -euo pipefail
+# shellcheck source=../env.sh
+. "$(dirname "${BASH_SOURCE[0]}")/../env.sh"
+HERE="$ROOT/packaging/linux"
+
+PUSH=0
+TARBALL=""
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ --push) PUSH=1; shift ;;
+ -h | --help) sed -n '2,12p' "$0"; exit 0 ;;
+ -*) echo "unknown argument: $1" >&2; exit 2 ;;
+ *) TARBALL="$1"; shift ;;
+ esac
+done
+
+ARCH="$(uname -m)"
+case "$ARCH" in
+ x86_64) ;;
+ aarch64 | arm64) ARCH=aarch64 ;;
+ *) echo "unsupported architecture $ARCH" >&2; exit 2 ;;
+esac
+
+BASENAME="craft-anything-$VERSION-linux-$ARCH"
+OUT_OCI="$DIST/$BASENAME-oci"
+
+echo "==> Building Flatpak OCI layout for $BASENAME"
+"$HERE/flatpak-bundle.sh" --oci --no-test "${TARBALL:-}"
+
+[[ -d "$OUT_OCI" ]] || { echo "error: $OUT_OCI layout not generated" >&2; exit 1; }
+
+REGISTRY="${REGISTRY:-ghcr.io/storytold/craft-anything}"
+TAG="${TAG:-$VERSION-$ARCH}"
+
+echo "==> OCI layout ready at $OUT_OCI (Target: $REGISTRY:$TAG)"
+
+if [[ "$PUSH" = 1 ]]; then
+ command -v skopeo >/dev/null || { echo "error: skopeo is required to push OCI images (apt install skopeo)" >&2; exit 1; }
+
+ AUTH_ARGS=()
+ if [[ -n "${GITHUB_TOKEN:-}" ]]; then
+ AUTH_ARGS=(--dest-creds "${GITHUB_ACTOR:-storytold}:$GITHUB_TOKEN")
+ fi
+
+ echo "==> Pushing to $REGISTRY:$TAG"
+ skopeo copy --format oci "${AUTH_ARGS[@]}" "oci:$OUT_OCI" "docker://$REGISTRY:$TAG"
+
+ # Also update architecture-specific stable tag
+ echo "==> Pushing to $REGISTRY:stable-$ARCH"
+ skopeo copy --format oci "${AUTH_ARGS[@]}" "oci:$OUT_OCI" "docker://$REGISTRY:stable-$ARCH"
+
+ echo "==> Push complete"
+fi
diff --git a/xtask/src/main.rs b/xtask/src/main.rs
index 9acf0135..8b9ce6a5 100644
--- a/xtask/src/main.rs
+++ b/xtask/src/main.rs
@@ -59,6 +59,7 @@ fn main() -> ExitCode {
&& run("cargo", &["clippy", "-p", "craft-anything-engine", "--features", "wasm-plugins", "--all-targets", "--", "-D", "warnings"])
&& run("cargo", &["test", "-p", "craft-anything-engine", "--features", "wasm-plugins"])
&& tools(&root, true)
+ && schemas(&root, true)
&& wasm()
}
_ => {