Files
SnapOtter/.github/workflows/ai-bundles.yml
T
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
72ad63479c chore(deps): bump the actions group with 5 updates (#236)
Bumps the actions group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [actions/checkout](https://github.com/actions/checkout) | `6.0.2` | `6.0.3` |
| [actions/upload-artifact](https://github.com/actions/upload-artifact) | `4.6.2` | `7.0.1` |
| [actions/download-artifact](https://github.com/actions/download-artifact) | `4.3.0` | `8.0.1` |
| [actions/cache](https://github.com/actions/cache) | `4.2.3` | `5.0.5` |
| [github/codeql-action](https://github.com/github/codeql-action) | `4.36.0` | `4.36.2` |


Updates `actions/checkout` from 6.0.2 to 6.0.3
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/de0fac2e4500dabe0009e67214ff5f5447ce83dd...df4cb1c069e1874edd31b4311f1884172cec0e10)

Updates `actions/upload-artifact` from 4.6.2 to 7.0.1
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v4.6.2...043fb46d1a93c77aae656e7c1c64a875d1fc6a0a)

Updates `actions/download-artifact` from 4.3.0 to 8.0.1
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v4.3.0...3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c)

Updates `actions/cache` from 4.2.3 to 5.0.5
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/5a3ec84eff668545956fd18022155c47e93e2684...27d5ce7f107fe9357f9df03efb73ab90386fccae)

Updates `github/codeql-action` from 4.36.0 to 4.36.2
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/7211b7c8077ea37d8641b6271f6a365a22a5fbfa...8aad20d150bbac5944a9f9d289da16a4b0d87c1e)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 6.0.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: actions/upload-artifact
  dependency-version: 7.0.1
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actions/download-artifact
  dependency-version: 8.0.1
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actions/cache
  dependency-version: 5.0.5
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: github/codeql-action
  dependency-version: 4.36.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-15 15:02:17 +08:00

164 lines
5.0 KiB
YAML

name: AI Bundles
on:
workflow_dispatch:
inputs:
version:
description: "Version to build bundles for (e.g., 2.0.0)"
required: true
type: string
workflow_call:
inputs:
version:
type: string
required: true
concurrency:
group: ai-bundles-${{ inputs.version }}
cancel-in-progress: false
permissions: {}
jobs:
build:
name: ${{ matrix.bundle }} (${{ matrix.arch }})
strategy:
fail-fast: false
matrix:
include:
- bundle: background-removal
arch: amd64-gpu
runner: ubuntu-latest
- bundle: background-removal
arch: arm64-cpu
runner: ubuntu-24.04-arm
- bundle: face-detection
arch: amd64-gpu
runner: ubuntu-latest
- bundle: face-detection
arch: arm64-cpu
runner: ubuntu-24.04-arm
- bundle: object-eraser-colorize
arch: amd64-gpu
runner: ubuntu-latest
- bundle: object-eraser-colorize
arch: arm64-cpu
runner: ubuntu-24.04-arm
- bundle: upscale-enhance
arch: amd64-gpu
runner: ubuntu-latest
- bundle: upscale-enhance
arch: arm64-cpu
runner: ubuntu-24.04-arm
- bundle: photo-restoration
arch: amd64-gpu
runner: ubuntu-latest
- bundle: photo-restoration
arch: arm64-cpu
runner: ubuntu-24.04-arm
- bundle: ocr
arch: amd64-gpu
runner: ubuntu-latest
- bundle: ocr
arch: arm64-cpu
runner: ubuntu-24.04-arm
- bundle: transcription
arch: amd64-gpu
runner: ubuntu-latest
- bundle: transcription
arch: arm64-cpu
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
permissions:
contents: read
packages: read
steps:
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc \
/usr/local/share/boost /opt/hostedtoolcache/CodeQL
sudo docker system prune -af
df -h /
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
ref: v${{ inputs.version }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- name: Log in to GHCR
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Build bundle inside Docker image
env:
BUNDLE: ${{ matrix.bundle }}
ARCH: ${{ matrix.arch }}
VERSION: ${{ inputs.version }}
run: |
mkdir -p /tmp/bundles
docker run --rm --entrypoint bash \
-v "$PWD/docker/build-bundle.sh:/build-bundle.sh:ro" \
-v "/tmp/bundles:/output" \
"ghcr.io/snapotter-hq/snapotter:${VERSION}" \
/build-bundle.sh "${BUNDLE}" "${ARCH}" /output
- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ matrix.bundle }}-${{ matrix.arch }}
path: /tmp/bundles/
retention-days: 1
publish:
name: Publish to HuggingFace
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Download all artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: /tmp/artifacts
- name: Install huggingface-hub
run: pip install huggingface-hub
- name: Organize and upload to HuggingFace
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
VERSION: ${{ inputs.version }}
run: |
mkdir -p "/tmp/upload/v${VERSION}"
find /tmp/artifacts -name '*.tar.gz' -exec cp {} "/tmp/upload/v${VERSION}/" \;
find /tmp/artifacts -name '*.sha256' -exec cp {} "/tmp/upload/v${VERSION}/" \;
cd "/tmp/upload/v${VERSION}"
echo '{"version":"'"${VERSION}"'","archives":[' > manifest.json
first=true
for archive in *.tar.gz; do
[ -f "$archive" ] || continue
sha=$(sha256sum "$archive" | cut -d' ' -f1)
size=$(stat --format=%s "$archive")
if [ "$first" = true ]; then
first=false
else
echo ',' >> manifest.json
fi
printf '{"file":"%s","sha256":"%s","size":%s}' "$archive" "$sha" "$size" >> manifest.json
done
echo ']}' >> manifest.json
huggingface-cli upload snapotter/feature-bundles \
"/tmp/upload/v${VERSION}" "v${VERSION}" \
--repo-type model --token "${HF_TOKEN}"
echo "Published: https://huggingface.co/snapotter/feature-bundles/tree/main/v${VERSION}"