Readme

Reusable GitHub Workflows

A collection of reusable GitHub Actions workflows.

Table of Contents

Workflows

Go Release (go-release.yml)

A complete CI/CD workflow for Go projects that handles testing, cross-platform builds and releases. For Homebrew tap updates, pair it with Homebrew Release using this workflow’s outputs.

Features

  • Runs tests with configurable test command
  • Cross-platform builds (Linux, macOS, Windows)
  • Automated releases via release-please
  • Exposes release_created and tag_name for follow-up jobs

Usage

name: Release

on:
  push:
    branches: [master]
  pull_request:
    branches: [master]

jobs:
  release:
    uses: chenasraf/workflows/.github/workflows/go-release.yml@master
    with:
      name: my-cli
      platforms: '["linux/amd64", "darwin/arm64"]'
      main-branch: main

  homebrew:
    needs: release
    if: ${{ needs.release.outputs.release_created }}
    uses: chenasraf/workflows/.github/workflows/homebrew-release.yml@master
    with:
      homebrew-tap-repo: myorg/homebrew-tap
      tag: ${{ needs.release.outputs.tag_name }}
    secrets:
      REPO_DISPATCH_PAT: ${{ secrets.REPO_DISPATCH_PAT }}

Inputs

InputDescriptionRequiredDefault
nameBinary/project nameYes-
go-versionGo version for the test jobNothe go directive in <working-directory>/go.mod
platformsJSON array of platforms to buildNo["linux/amd64", "darwin/amd64", "darwin/arm64", "windows/amd64"]
packageGo package path (empty for root)No""
working-directoryDirectory containing the Go moduleNo.
release-typeRelease Please release type (simple, node, etc.)Nosimple
compressCompress build artifactsNotrue
test-commandTest command to runNogo test -v ./...
skip-testsSkip running testsNofalse
main-branchMain branch name for releasesNomaster

Outputs

OutputDescription
release_createdWhether a release was created
tag_nameThe release tag name

Homebrew Release (homebrew-release.yml)

Sends a repository dispatch to a Homebrew tap with a release’s tag and notes, for a tap that listens for trigger-from-release events with payload { tag, repo, body }. It has no build steps, so it follows a release job (see Go Release) or suits shell-only packages.

Usage

jobs:
  homebrew:
    needs: release
    if: ${{ needs.release.outputs.release_created }}
    uses: chenasraf/workflows/.github/workflows/homebrew-release.yml@master
    with:
      homebrew-tap-repo: myorg/homebrew-tap
      tag: ${{ needs.release.outputs.tag_name }}
    secrets:
      REPO_DISPATCH_PAT: ${{ secrets.REPO_DISPATCH_PAT }}

Inputs

InputDescriptionRequiredDefault
homebrew-tap-repoHomebrew tap repo to dispatch to (e.g., owner/homebrew-tap)Yes-
tagRelease tag to dispatchNoLatest release

Secrets

SecretDescriptionRequired
REPO_DISPATCH_PATPAT for dispatching to homebrew tap repoYes

Manual Homebrew Release (manual-homebrew-release.yml)

Manually triggers a Homebrew tap update for the latest release. Useful when you need to re-trigger a Homebrew formula update without creating a new release.

Features

  • Fetches the latest release tag and body from the repository
  • Sends a repository dispatch event to your Homebrew tap repo
  • Works with any Homebrew tap that listens for trigger-from-release events with payload: { tag, repo, body }

Usage

name: Manual Homebrew Release

on:
  workflow_dispatch:

jobs:
  homebrew:
    uses: chenasraf/workflows/.github/workflows/manual-homebrew-release.yml@master
    with:
      homebrew-tap-repo: myorg/homebrew-tap
    secrets:
      REPO_DISPATCH_PAT: ${{ secrets.REPO_DISPATCH_PAT }}

Inputs

InputDescriptionRequiredDefault
homebrew-tap-repoHomebrew tap repo to dispatch to (e.g., owner/homebrew-tap)Yes-

Secrets

SecretDescriptionRequired
REPO_DISPATCH_PATPAT for dispatching to homebrew tap repoYes

Release Please + F-Droid Changelog (release-please-fdroid-changelog.yml)

Runs release-please, then when a release PR is created or updated, copies the curated notes for the PR’s version (release-notes/<version>/play.txt by default) to <changelog-dir>/<versionCode>.txt, where F-Droid reads them from the tagged source. The file is amended into release-please’s commit, so the tag carries it. When the notes don’t exist yet, nothing is copied; pair it with Release Notes Check to keep the release PR from merging without them.

Usage

jobs:
  release-please:
    uses: chenasraf/workflows/.github/workflows/release-please-fdroid-changelog.yml@fastlane-latest
    with:
      release-type: dart
    secrets:
      token: ${{ secrets.RELEASE_PLEASE_TOKEN }}

  build:
    needs: release-please
    if: ${{ needs.release-please.outputs.release_created }}
    # ...

Inputs

InputDescriptionRequiredDefault
release-typeRelease Please release type (dart, node, python, go, etc.)Yes-
version-filepubspec-style file holding version: <name>+<code>Nopubspec.yaml
notes-fileNotes to copy; {version} is replaced with the version nameNorelease-notes/{version}/play.txt
changelog-dirDirectory F-Droid reads changelogs fromNofastlane/metadata/android/en-US/changelogs

Secrets

SecretDescriptionRequired
tokenGitHub token for release-please (defaults to GITHUB_TOKEN)No

Outputs

OutputDescription
release_createdWhether a release was created
tag_nameThe release tag name
versionThe release version

Release Notes Check (release-notes-check.yml)

Checks that release-notes/<version>/ holds complete curated notes: full.md plus one file per destination in release-notes/config.yml, each non-empty, within its character limit, and without leftover template text (<!-- … -->).

  • mode: pr checks the release-please PR and passes on every other PR, so it can be a required status check.
  • mode: release runs on pushes to the default branch. When the version file’s version has no tag yet, the push is the release and the notes must be complete; make tagging and publishing jobs depend on it so a release PR merged past the check doesn’t ship.

Usage

jobs:
  release-notes:
    uses: chenasraf/workflows/.github/workflows/release-notes-check.yml@release-notes-latest
    with:
      mode: ${{ github.event_name == 'pull_request' && 'pr' || 'release' }}

release-notes/config.yml:

version:
  file: pubspec.yaml
  pattern: '^version:[[:space:]]*([0-9]+\.[0-9]+\.[0-9]+)' # ERE, version in group 1
tag-prefix: v
destinations:
  play: { file: play.txt, limit: 500 }
  ios: { file: ios.txt, limit: 4000 }
  appstore: { file: appstore.md } # no limit: presence and template text only

Inputs

InputDescriptionRequiredDefault
modepr or releaseYes-
configPath to the release notes configNorelease-notes/config.yml
release-branch-prefixHead branch prefix that marks the release PRNorelease-please--

Nextcloud Workflows

Reusable workflows for Nextcloud app development. These workflows include automatic path filtering to skip unnecessary runs when irrelevant files change.

PHPUnit MySQL (nextcloud-phpunit-mysql.yml)

Runs PHPUnit tests with MySQL database.

jobs:
  phpunit:
    uses: chenasraf/workflows/.github/workflows/nextcloud-phpunit-mysql.yml@nextcloud-latest
    with:
      php-versions-min: '8.1'
      php-versions-max: '8.4'
      mysql-version: '8.0'
      path-filters: |
        - 'lib/**'
        - 'tests/**'
        - 'composer.json'
InputDescriptionRequiredDefault
php-versions-minMinimum PHP versionNo8.2
php-versions-maxMaximum PHP versionNo8.3
mysql-versionMySQL versionNo8.4
php-extensionsPHP extensions to installNo(common extensions)
path-filtersPaths to trigger on (YAML list)No(lib, tests, etc.)

PHPUnit PostgreSQL (nextcloud-phpunit-pgsql.yml)

Runs PHPUnit tests with PostgreSQL database.

jobs:
  phpunit:
    uses: chenasraf/workflows/.github/workflows/nextcloud-phpunit-pgsql.yml@nextcloud-latest
    with:
      php-version: '8.2'
      path-filters: |
        - 'lib/**'
        - 'tests/**'
InputDescriptionRequiredDefault
php-versionPHP versionNo8.3
php-extensionsPHP extensions to installNo(common extensions)
path-filtersPaths to trigger on (YAML list)No(lib, tests, etc.)

PHPUnit Incremental Migration (nextcloud-phpunit-incremental.yml)

Tests database migrations by upgrading from a baseline version.

jobs:
  incremental:
    uses: chenasraf/workflows/.github/workflows/nextcloud-phpunit-incremental.yml@nextcloud-latest
    with:
      baseline-version: v1.0.0
      php-version: '8.2'
      validation-query: 'SELECT COUNT(*) FROM oc_myapp_users'
      path-filters: |
        - 'lib/Migration/**'
        - 'appinfo/info.xml'
InputDescriptionRequiredDefault
baseline-versionGit tag/ref to upgrade fromYes-
php-versionPHP versionNo8.3
php-extensions-mysqlPHP extensions for MySQL testsNo(common extensions)
php-extensions-pgsqlPHP extensions for PostgreSQL testsNo(common extensions)
validation-querySQL query to validate migrationNo(empty)
path-filtersPaths to trigger on (YAML list)No(lib, tests, etc.)

Psalm Static Analysis (nextcloud-psalm.yml)

Runs Psalm static analysis across supported Nextcloud versions.

jobs:
  psalm:
    uses: chenasraf/workflows/.github/workflows/nextcloud-psalm.yml@nextcloud-latest
    with:
      psalm-command: 'composer run psalm -- --show-info=true'
      path-filters: |
        - 'lib/**/*.php'
        - 'psalm.xml'
InputDescriptionRequiredDefault
psalm-commandCommand to run PsalmNocomposer run psalm
php-extensionsPHP extensions to installNo(common extensions)
path-filtersPaths to trigger on (YAML list)No**.php, psalm.xml

PHP Lint (nextcloud-lint-php.yml)

Runs PHP syntax linting across supported PHP versions.

jobs:
  lint:
    uses: chenasraf/workflows/.github/workflows/nextcloud-lint-php.yml@nextcloud-latest
    with:
      lint-command: 'composer run lint -- --colors'
      path-filters: |
        - 'lib/**/*.php'
        - 'appinfo/**/*.php'
InputDescriptionRequiredDefault
lint-commandCommand to run lintNocomposer run lint
php-extensionsPHP extensions to installNo(common extensions)
path-filtersPaths to trigger on (YAML list)No**.php

PHP-CS-Fixer (nextcloud-lint-php-cs.yml)

Checks PHP code style with PHP-CS-Fixer.

jobs:
  cs:
    uses: chenasraf/workflows/.github/workflows/nextcloud-lint-php-cs.yml@nextcloud-latest
    with:
      cs-check-command: 'vendor/bin/php-cs-fixer fix --dry-run --diff'
      path-filters: |
        - 'lib/**/*.php'
        - 'tests/**/*.php'
InputDescriptionRequiredDefault
cs-check-commandCommand to check code styleNocomposer run cs:check
php-extensionsPHP extensions to installNo(common extensions)
path-filtersPaths to trigger on (YAML list)No**.php, .php-cs-fixer.dist.php

ESLint (nextcloud-lint-eslint.yml)

Runs ESLint on frontend code.

jobs:
  eslint:
    uses: chenasraf/workflows/.github/workflows/nextcloud-lint-eslint.yml@nextcloud-latest
    with:
      lint-command: 'pnpm lint --max-warnings 0'
      path-filters: |
        - 'src/**/*.ts'
        - 'src/**/*.vue'
InputDescriptionRequiredDefault
lint-commandCommand to run lintNopnpm lint
path-filtersPaths to trigger on (YAML list)Nosrc/**, *.ts, *.js, etc.

OpenAPI Lint (nextcloud-lint-openapi.yml)

Validates OpenAPI spec is up to date.

jobs:
  openapi:
    uses: chenasraf/workflows/.github/workflows/nextcloud-lint-openapi.yml@nextcloud-latest
    with:
      openapi-command: 'composer run generate-openapi'
      typescript-types-pattern: 'src/api/types/*.ts'
      path-filters: |
        - 'lib/Controller/**/*.php'
        - 'openapi.json'
InputDescriptionRequiredDefault
openapi-commandCommand to regenerate OpenAPINocomposer run openapi
typescript-types-patternGlob for TypeScript typesNosrc/types/openapi/openapi*.ts
path-filtersPaths to trigger on (YAML list)Nolib/**/*.php, openapi.json

AppInfo XML Lint (nextcloud-lint-appinfo-xml.yml)

Validates appinfo/info.xml against schema.

jobs:
  xml:
    uses: chenasraf/workflows/.github/workflows/nextcloud-lint-appinfo-xml.yml@nextcloud-latest
    with:
      xml-file: './custom/path/info.xml'
      path-filters: |
        - 'custom/path/info.xml'
InputDescriptionRequiredDefault
xml-filePath to the info.xml fileNo./appinfo/info.xml
schema-urlURL to XML schemaNo(Nextcloud schema)
path-filtersPaths to trigger on (YAML list)Noappinfo/info.xml

NPM Build (nextcloud-build-npm.yml)

Builds frontend assets with pnpm.

jobs:
  build:
    uses: chenasraf/workflows/.github/workflows/nextcloud-build-npm.yml@nextcloud-latest
    with:
      build-command: 'pnpm build:prod'
      path-filters: |
        - 'src/**'
        - 'package.json'
        - 'pnpm-lock.yaml'
InputDescriptionRequiredDefault
build-commandCommand to run buildNopnpm build
path-filtersPaths to trigger on (YAML list)Nosrc/**, *.json, etc.

Vitest (nextcloud-vitest.yml)

Runs Vitest frontend tests.

jobs:
  vitest:
    uses: chenasraf/workflows/.github/workflows/nextcloud-vitest.yml@nextcloud-latest
    with:
      node-version: '20'
      test-command: 'pnpm vitest run --coverage'
      path-filters: |
        - 'src/**'
        - 'tests/**'
InputDescriptionRequiredDefault
node-versionNode.js version to useNo22
test-commandCommand to run testsNopnpm test:run
path-filtersPaths to trigger on (YAML list)Nosrc/**, *.ts, etc.

Block Unconventional Commits (nextcloud-block-unconventional-commits.yml)

Blocks commits that don’t follow conventional commit format.

jobs:
  commits:
    uses: chenasraf/workflows/.github/workflows/nextcloud-block-unconventional-commits.yml@nextcloud-latest
    with:
      allowed-types: 'feat,fix,docs,chore,refactor'
InputDescriptionRequiredDefault
allowed-typesComma-separated list of allowed commit typesNo(feat, fix, docs, etc.)

License

MIT