Skip to content
Draft
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
76 changes: 76 additions & 0 deletions .github/workflows/update_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Copyright MediaZ Teknoloji A.S. All Rights Reserved.

name: Update Plugin Workflows

on:
push:
branches:
- main
paths:
- 'plugin_build.yml.*'
- 'repositories.json'
- 'scripts/update_workflows.py'
- '.github/workflows/update_workflow.yml'
workflow_dispatch:
inputs:
repo:
description: 'Specific repository to update (owner/repo, optional)'
required: false
type: string
branch:
description: 'Specific branch to update (requires repo, optional)'
required: false
type: string
dry_run:
description: 'Dry run mode (show what would be done)'
required: false
type: boolean
default: false

jobs:
update-workflows:
name: Update Plugin Repository Workflows
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout actions repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Update workflows
env:
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }}
run: |
python3 scripts/update_workflows.py \
--config repositories.json \
${{ github.event.inputs.repo && format('--repo {0}', github.event.inputs.repo) || '' }} \
${{ github.event.inputs.branch && format('--branch {0}', github.event.inputs.branch) || '' }} \
${{ github.event.inputs.dry_run == 'true' && '--dry-run' || '' }}

- name: Summary
if: always()
run: |
echo "## Workflow Update Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ "${{ github.event.inputs.dry_run }}" == "true" ]; then
echo "**Mode:** Dry Run (no changes made)" >> $GITHUB_STEP_SUMMARY
else
echo "**Mode:** Live Update" >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
if [ -n "${{ github.event.inputs.repo }}" ]; then
echo "**Repository:** ${{ github.event.inputs.repo }}" >> $GITHUB_STEP_SUMMARY
if [ -n "${{ github.event.inputs.branch }}" ]; then
echo "**Branch:** ${{ github.event.inputs.branch }}" >> $GITHUB_STEP_SUMMARY
fi
else
echo "**Scope:** All repositories" >> $GITHUB_STEP_SUMMARY
fi
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# Virtual environments
venv/
ENV/
env/

# IDEs
.vscode/
.idea/
*.swp
*.swo
*~

# OS
.DS_Store
Thumbs.db
5 changes: 5 additions & 0 deletions .nodos-template/workflow_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"build_number_offset": 0,
"linux_enabled": true,
"windows_enabled": true
}
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
# Nodos Action Matrix
# Nodos Actions Repository

This repository contains GitHub Actions workflows and automation tools for the Nodos project.

## Plugin Workflow Sync System

This repository includes an automated system for syncing build workflow files to all plugin repositories. This ensures that all plugins use consistent, up-to-date workflow configurations.

**Key Features:**
- Templated workflow files for different branches (dev, nodos-1.3, nodos-1.2)
- Repository-specific configuration support (build number offsets, platform toggles)
- Automatic synchronization on template changes
- Manual sync capability for testing and updates

For detailed information, see [WORKFLOW_SYNC_README.md](WORKFLOW_SYNC_README.md)

## Build Status Matrix

Badges below show the latest GitHub Actions run status for each build workflow on the `dev`, `nodos-1.3`, and `nodos-1.2` branches.

Expand Down
116 changes: 116 additions & 0 deletions WORKFLOW_SYNC_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Plugin Workflow Sync System

This directory contains the workflow synchronization system for plugin repositories.

## Overview

The system automatically syncs build workflow files from this repository to all plugin repositories, ensuring they stay in sync and up-to-date.

## Files

### Template Files

- `plugin_build.yml.dev` - Workflow template for `dev` branches
- `plugin_build.yml.nodos-1.3` - Workflow template for `nodos-1.3` branches
- `plugin_build.yml.nodos-1.2` - Workflow template for `nodos-1.2` branches

These templates contain placeholders that are replaced with repository-specific values:
- `__BUILD_NUMBER_OFFSET__` - Starting build number offset for the repository
- `__LINUX_ENABLED__` - Whether Linux builds are enabled (true/false)
- `__WINDOWS_ENABLED__` - Whether Windows builds are enabled (true/false)

### Configuration Files

- `repositories.json` - Maps repositories and branches to their workflow templates
- `.nodos-template/workflow_config.json` - Example repository-specific configuration

### Scripts

- `scripts/update_workflows.py` - Python script that performs the workflow synchronization

### Workflows

- `.github/workflows/update_workflow.yml` - GitHub Actions workflow that runs the sync

## How It Works

1. When changes are pushed to template files or configuration in this repository, the `update_workflow.yml` workflow is triggered
2. The workflow runs `update_workflows.py` which:
- Reads `repositories.json` to get the list of repositories/branches to update
- For each repository/branch:
- Clones the repository
- Reads the repository-specific configuration from `.nodos/workflow_config.json`
- Applies the template substitutions
- Writes the result to `.github/workflows/build.yml`
- Commits and pushes the changes
3. Plugin repositories are updated automatically with the latest workflow files

## Repository-Specific Configuration

Each plugin repository can have a `.nodos/workflow_config.json` file with the following structure:

```json
{
"build_number_offset": 0,
"linux_enabled": true,
"windows_enabled": true
}
```

**Fields:**
- `build_number_offset` (number): Offset to add to GitHub's `run_number` for build numbering. Default: 0
- `linux_enabled` (boolean): Whether Linux builds are enabled for this repository. Default: true
- `windows_enabled` (boolean): Whether Windows builds are enabled for this repository. Default: true

If the configuration file doesn't exist, default values are used (all enabled, no offset).

## Adding a New Plugin Repository

1. Add an entry to `repositories.json` for each branch you want to sync:

```json
{
"repo": "nodos-dev/new-plugin",
"branch": "dev",
"workflow_template": "plugin_build.yml.dev"
}
```

2. Optionally, create `.nodos/workflow_config.json` in the plugin repository with custom settings

3. Push the changes to this repository, which will trigger the automatic sync

## Manual Workflow Sync

You can manually trigger the workflow sync from the Actions tab:

1. Go to Actions → Update Plugin Workflows
2. Click "Run workflow"
3. Optionally specify:
- A specific repository to update (e.g., `nodos-dev/audio`)
- A specific branch (requires repository)
- Dry run mode to preview changes without applying them

## Template Customization

To customize the workflow templates:

1. Edit the appropriate `plugin_build.yml.*` file
2. Use placeholders (`__PLACEHOLDER__`) for repository-specific values
3. Update `scripts/update_workflows.py` if you add new placeholders
4. Push changes to trigger automatic sync

## Testing

To test changes without affecting production:

1. Use the workflow dispatch option with dry-run mode enabled
2. Or test with a specific repository/branch first
3. Check the logs to see what changes would be made

## Notes

- The workflow files in plugin repositories should NOT be edited directly
- Changes should be made to the templates in this repository
- The sync system uses the `CI_TOKEN` secret for authentication
- Failed syncs will be reported in the workflow logs
88 changes: 88 additions & 0 deletions plugin_build.yml.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Copyright MediaZ Teknoloji A.S. All Rights Reserved.
# This file is automatically synced from the nodos-dev/actions repository
# DO NOT edit this file directly in the plugin repository

name: Build

on:
push:
branches: [ dev ]
workflow_dispatch:
inputs:
publish_mode:
description: 'Publish Mode'
required: true
default: 'If Changed'
type: choice
options:
- If Changed
- Force
- None
plugin_names:
description: 'Publish only these plugins (semicolon-delimited) (optional)'
required: false
default: ''
type: string
run_tests:
description: 'Run Tests'
required: false
default: false
type: boolean
clean:
description: 'Clean build'
required: false
default: false
type: boolean
sign_binaries:
description: 'Sign binaries'
required: false
default: false
type: boolean
linux:
description: 'Release for Linux'
required: false
default: true
type: boolean
windows:
description: 'Release for Windows'
required: false
default: true
type: boolean
version_check:
description: 'Version Check'
required: true
default: 'strict'
type: choice
options:
- none
- loose
- strict

run-name: >-
${{ ((github.event_name == 'push') && format('Build Only: {0}', github.event.head_commit.message)) ||
(github.event.inputs.publish_mode == 'If Changed') && 'Build & Release' ||
(github.event.inputs.publish_mode == 'Force') && 'Build & Release (Force)' ||
'Build Only' }}

concurrency:
group: single
cancel-in-progress: false

jobs:
call-release-plugins:
name: Build
uses: nodos-dev/actions/.github/workflows/plugins.yml@main
secrets:
CI_TOKEN: ${{ secrets.CI_TOKEN }}
SENTRY_TOKEN: ${{ secrets.SENTRY_TOKEN }}
with:
ref_name: ${{ github.ref_name }}
publish_mode: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.publish_mode || 'None' }}
plugin_names: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.plugin_names || '' }}
clean: ${{ github.event_name == 'workflow_dispatch' && fromJson(github.event.inputs.clean) || false }}
build_number: ${{ github.run_number + __BUILD_NUMBER_OFFSET__ }}
sign_binaries: ${{github.event_name == 'workflow_dispatch' && fromJson(github.event.inputs.sign_binaries) || false }}
linux: ${{ __LINUX_ENABLED__ && (github.event_name == 'workflow_dispatch' && fromJson(github.event.inputs.linux) || github.event_name == 'push') }}
windows: ${{ __WINDOWS_ENABLED__ && (github.event_name == 'workflow_dispatch' && fromJson(github.event.inputs.windows) || github.event_name == 'push') }}
run_tests: ${{ github.event_name == 'workflow_dispatch' && fromJson(github.event.inputs.run_tests) || false }}
version_check: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version_check || 'strict' }}
Loading