Skip to content

Marketplace Release #23

Marketplace Release

Marketplace Release #23

# SPDX-FileCopyrightText: © 2025 StreamKit Contributors
#
# SPDX-License-Identifier: MPL-2.0
name: Marketplace Release
on:
workflow_dispatch:
inputs:
prerelease:
description: "Mark releases as prerelease"
required: false
type: boolean
default: false
jobs:
marketplace:
uses: ./.github/workflows/marketplace-build.yml
permissions:
contents: write
pull-requests: write
secrets: inherit
create-releases:
name: Create Per-Plugin Releases
needs: [marketplace]
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/checkout@v5
- name: Download bundles
uses: actions/download-artifact@v4
with:
name: marketplace-bundles
path: artifacts/bundles
- name: Download new plugins manifest
uses: actions/download-artifact@v4
with:
name: new-plugins
path: artifacts
- name: Load plugin metadata
id: plugins
run: |
if [ ! -f artifacts/new-plugins.json ]; then
echo "No new-plugins.json found"
echo "matrix=[]" >> "$GITHUB_OUTPUT"
exit 0
fi
matrix=$(python3 -c "
import json, sys
data = json.load(open('artifacts/new-plugins.json'))
plugins = data.get('plugins', [])
print(json.dumps(plugins))
")
echo "matrix=${matrix}" >> "$GITHUB_OUTPUT"
- name: Load plugin names
id: names
run: |
names=$(python3 -c "
import json
data = json.load(open('marketplace/official-plugins.json'))
mapping = {p['id']: p.get('name', p['id']) for p in data.get('plugins', [])}
print(json.dumps(mapping))
")
echo "names=${names}" >> "$GITHUB_OUTPUT"
- name: Create per-plugin releases
if: steps.plugins.outputs.matrix != '[]'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PLUGIN_MATRIX: ${{ steps.plugins.outputs.matrix }}
PLUGIN_NAMES: ${{ steps.names.outputs.names }}
IS_PRERELEASE: ${{ inputs.prerelease }}
run: |
echo "${PLUGIN_MATRIX}" | python3 -c "
import json, os, subprocess, sys
plugins = json.loads(sys.stdin.read())
names = json.loads(os.environ['PLUGIN_NAMES'])
is_prerelease = os.environ.get('IS_PRERELEASE', 'false') == 'true'
for plugin in plugins:
pid = plugin['id']
version = plugin['version']
tag = f'plugin-{pid}-v{version}'
name = names.get(pid, pid)
release_name = f'{name} v{version}'
bundle = f'artifacts/bundles/{pid}-{version}-bundle.tar.zst'
cmd = [
'gh', 'release', 'create', tag,
'--target', os.environ.get('GITHUB_SHA', 'HEAD'),
'--title', release_name,
'--notes', f'Plugin bundle for {name} v{version}.',
bundle,
]
if is_prerelease:
cmd.append('--prerelease')
print(f'Creating release: {tag}')
result = subprocess.run(cmd)
if result.returncode != 0:
print(f'::warning::Skipping {tag}: release may already exist')
"