Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/catalog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Publish Community Store index

on:
schedule:
- cron: '17 * * * *'
- cron: '17 2 * * *'
workflow_dispatch:
push:
branches: [main]
Expand Down Expand Up @@ -32,7 +32,7 @@ concurrency:
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 45
timeout-minutes: 90
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
Expand Down
2 changes: 1 addition & 1 deletion docs/PUBLISHER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ To list your GitHub profile or organization by default, open a public request wi

Community Store maintainers manage default owners in [trusted-stores.json](../trusted-stores.json). After approving a request, maintainers add the GitHub login to the `additionalOwners` array and merge the change into `main`. Clients through 1.2.0 read the original 32 entries in `owners`. The next client build reads both lists and caches the combined directory for offline use. This file is outside the add-in release paths, so a change to this file alone updates the directory without publishing a new Store release. Community Store checks for changes at launch, when the palette opens, and during catalog checks. It keeps the last valid list for offline use and preserves manually added sources. A fresh installation uses `4FusionLab` until it retrieves a valid list.

The Pages-enabled client reads default catalog entries and version history from snapshots built hourly by GitHub Actions. Allow time for the next successful Pages deployment and client refresh after publishing a release. Manually subscribed owners outside the default catalog are checked directly on GitHub.
The Pages-enabled client reads default catalog entries and version history from snapshots built daily by GitHub Actions and whenever the publisher list changes. Maintainers can also trigger a build manually. Allow time for the next successful Pages deployment and client refresh after publishing a release. Manually subscribed owners outside the default catalog are checked directly on GitHub.

In the next Store build, the Pages snapshot also supplies the default catalog’s icons, thumbnails, screenshots and localized README files. The list loads the thumbnail and icon on demand. Opening the detail page loads the selected README and larger images. The same tagged files and artwork priorities below apply to indexed and manually subscribed sources.

Expand Down
2 changes: 1 addition & 1 deletion docs/PUBLISHER_GUIDE.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Community Store также распознаёт обычный аддин Fusion

Команда Community Store ведёт список источников по умолчанию в файле [trusted-stores.json](../trusted-stores.json). Одобрив заявку, команда добавляет логин владельца GitHub в массив `additionalOwners` и вносит изменение в ветку `main`. Клиенты до версии 1.2.0 включительно читают исходные 32 записи в `owners`. Следующая сборка клиента читает оба списка и сохраняет объединённый каталог для работы офлайн. Файл лежит за пределами списка путей выпуска аддина. Правка только этого файла обновляет список источников без выпуска новой версии Store. Community Store проверяет изменения при запуске, открытии палитры и проверках каталога. Последний корректный список доступен офлайн, источники, добавленные вручную, сохраняются. В новой установке доступен `4FusionLab` до получения корректного списка.

Версия клиента с поддержкой Pages получает карточки каталога по умолчанию и историю версий из индекса. GitHub Actions собирает его раз в час. После публикации релиза карточка обновится при следующей успешной публикации Pages и проверке на устройстве. Источники, добавленные пользователем вне каталога по умолчанию, проверяются напрямую через GitHub.
Версия клиента с поддержкой Pages получает карточки каталога по умолчанию и историю версий из индекса. GitHub Actions собирает его раз в сутки, а также при изменении списка издателей. Сопровождающие могут запустить сборку вручную. После публикации релиза карточка обновится при следующей успешной публикации Pages и проверке на устройстве. Источники, добавленные пользователем вне каталога по умолчанию, проверяются напрямую через GitHub.

В следующей сборке Store индекс Pages также поставляет значки, миниатюры, скриншоты и локализованные README стандартного каталога. В списке по мере просмотра загружаются миниатюра и значок. При открытии карточки загружаются выбранный README и полноразмерные изображения. Для стандартных и вручную добавленных источников действуют описанные ниже правила выбора файлов из тега и приоритеты изображений.

Expand Down
26 changes: 20 additions & 6 deletions scripts/build_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,31 @@
TARGETS = (("windows", "x64"), ("mac", "arm64"), ("mac", "x64"))


def build_catalog(owners):
def build_catalog(owners, session=None):
def fetch(operation, *args):
while True:
try:
return operation(*args)
except releases.SessionEnded:
raise
except releases.RateLimited:
delay = max(1, releases.retry_at(session) - time.time() + 1)
print(f"GitHub API quota exhausted. Retrying in {delay:.0f} seconds.", flush=True)
time.sleep(delay)

def repositories(owner):
return list(releases.public_repositories(owner))

catalogs = {target: {owner: [] for owner in owners} for target in TARGETS}
stars = dict.fromkeys(owners, 0)
count = 0
for owner in owners:
for source in releases.public_repositories(owner):
for source in fetch(repositories, owner):
repo = source["repo"]
history = releases.history(repo)
history = fetch(releases.history, repo)
if not history:
continue
latest = releases.latest_option(repo)
latest = fetch(releases.latest_option, repo)
descriptions = {}
listed = False
for platform, arch in TARGETS:
Expand All @@ -46,7 +60,7 @@ def rank(option):
current if current["tag"] else options[0])
tag = selected["tag"]
if tag not in descriptions:
descriptions[tag] = releases.describe_release(source, selected, {})
descriptions[tag] = fetch(releases.describe_release, source, selected, {})
entry = descriptions[tag]
if entry["isAddin"]:
catalogs[platform, arch][owner].append({
Expand Down Expand Up @@ -168,7 +182,7 @@ def build(output):
session = releases.GitHubSession(github_auth.Tokens(token)) if token else None
with releases.use_session(session):
directory = json.loads((ROOT / trusted_stores.FILENAME).read_text(encoding="utf-8"))
catalogs, count, stars = build_catalog(trusted_stores.parse(directory))
catalogs, count, stars = build_catalog(trusted_stores.parse(directory), session)
output.mkdir(parents=True)
publish_artwork(catalogs, output / "artwork")
for (platform, arch), owners in catalogs.items():
Expand Down
16 changes: 16 additions & 0 deletions tests/test_pages_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,22 @@


class CatalogBuildTests(unittest.TestCase):
def test_rate_limit_wait_resumes_at_current_repository(self):
from scripts import build_catalog

session = build_catalog.releases.GitHubSession(None)
session.retry_at = 120
sources = [{"repo": "org/a"}, {"repo": "org/b"}]
with (patch.object(build_catalog.releases, "public_repositories", return_value=sources) as repos,
patch.object(build_catalog.releases, "history",
side_effect=[[], build_catalog.releases.RateLimited(), []]) as history,
patch.object(build_catalog.time, "time", return_value=100),
patch.object(build_catalog.time, "sleep") as sleep):
build_catalog.build_catalog(["org"], session)
repos.assert_called_once_with("org")
self.assertEqual([call.args[0] for call in history.call_args_list], ["org/a", "org/b", "org/b"])
sleep.assert_called_once_with(21)

def test_build_uses_workflow_token_for_repository_metadata(self):
from scripts import build_catalog

Expand Down
Loading