10 Commits

15 changed files with 685 additions and 109 deletions

89
.github/workflows/homebrew-release.yml vendored Normal file
View File

@@ -0,0 +1,89 @@
# Reusable Homebrew Release Workflow
#
# Dispatches a homebrew formula update to a tap repo.
# Does not include any build steps — suitable for shell-only packages.
#
# Call from other repos:
# jobs:
# homebrew:
# uses: chenasraf/workflows/.github/workflows/homebrew-release.yml@master
# with:
# homebrew-tap-repo: owner/homebrew-tap
# tag: ${{ needs.release.outputs.tag_name }}
# secrets:
# REPO_DISPATCH_PAT: ${{ secrets.REPO_DISPATCH_PAT }}
name: Homebrew Release
on:
workflow_call:
inputs:
homebrew-tap-repo:
description: 'Homebrew tap repo to dispatch to (e.g., owner/homebrew-tap)'
required: true
type: string
tag:
description: 'Release tag to dispatch (e.g., v1.0.0). If empty, uses the latest release tag.'
required: false
type: string
default: ''
secrets:
REPO_DISPATCH_PAT:
description: 'PAT for dispatching to homebrew tap repo'
required: true
permissions:
contents: read
jobs:
release-homebrew:
name: Trigger Homebrew Formula Update
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get release info
id: release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tag="${{ inputs.tag }}"
if [[ -z "$tag" ]]; then
tag=$(gh release view --json tagName -q .tagName)
echo "Using latest release tag: $tag"
else
echo "Using provided tag: $tag"
fi
echo "tag=$tag" >> "$GITHUB_OUTPUT"
body=$(gh release view "$tag" --json body -q .body)
echo "body<<EOF" >> "$GITHUB_OUTPUT"
echo "$body" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- name: Send dispatch to homebrew-tap
env:
GH_TOKEN: ${{ secrets.REPO_DISPATCH_PAT }}
run: |
tag="${{ steps.release.outputs.tag }}"
repo="${{ github.event.repository.name }}"
body=$(cat <<'BODY_EOF'
${{ steps.release.outputs.body }}
BODY_EOF
)
data=$(jq -n \
--arg tag "$tag" \
--arg repo "$repo" \
--arg body "$body" \
'{event_type: "trigger-from-release", client_payload: {tag: $tag, repo: $repo, body: $body}}')
echo "Dispatching tag $tag from $repo"
echo "Data: $data"
curl -X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GH_TOKEN" \
"https://api.github.com/repos/${{ inputs.homebrew-tap-repo }}/dispatches" \
-d "$data"
echo "Dispatched tag $tag from $repo"
echo "Created job on https://github.com/${{ inputs.homebrew-tap-repo }}/actions"

View File

@@ -0,0 +1,75 @@
# Reusable Manual Homebrew Release Workflow
#
# Call from other repos:
# jobs:
# homebrew:
# uses: chenasraf/workflows/.github/workflows/manual-homebrew-release.yml@master
# with:
# homebrew-tap-repo: owner/homebrew-tap
# secrets:
# REPO_DISPATCH_PAT: ${{ secrets.REPO_DISPATCH_PAT }}
name: Manual Homebrew Release
on:
workflow_call:
inputs:
homebrew-tap-repo:
description: 'Homebrew tap repo to dispatch to (e.g., owner/homebrew-tap)'
required: true
type: string
secrets:
REPO_DISPATCH_PAT:
description: 'PAT for dispatching to homebrew tap repo'
required: true
permissions:
contents: read
jobs:
release-homebrew:
name: Trigger Homebrew Formula Update
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get latest release info
id: latest
run: |
tag=$(gh release view --json tagName -q .tagName)
echo "Latest release tag: $tag"
echo "tag=$tag" >> "$GITHUB_OUTPUT"
body=$(gh release view --json body -q .body)
echo "body<<EOF" >> "$GITHUB_OUTPUT"
echo "$body" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Send dispatch to homebrew-tap
env:
GH_TOKEN: ${{ secrets.REPO_DISPATCH_PAT }}
run: |
tag="${{ steps.latest.outputs.tag }}"
repo="${{ github.event.repository.name }}"
body=$(cat <<'BODY_EOF'
${{ steps.latest.outputs.body }}
BODY_EOF
)
data=$(jq -n \
--arg tag "$tag" \
--arg repo "$repo" \
--arg body "$body" \
'{event_type: "trigger-from-release", client_payload: {tag: $tag, repo: $repo, body: $body}}')
echo "Dispatching tag $tag from $repo"
echo "Data: $data"
curl -X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GH_TOKEN" \
"https://api.github.com/repos/${{ inputs.homebrew-tap-repo }}/dispatches" \
-d "$data"
echo "Dispatched tag $tag from $repo"
echo "Created job on https://github.com/${{ inputs.homebrew-tap-repo }}/actions"

View File

@@ -41,18 +41,26 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Build filters
id: build-filters
run: |
echo "yaml<<EOF" >> $GITHUB_OUTPUT
echo "src:" >> $GITHUB_OUTPUT
cat <<'INPUT_EOF' | sed 's/^/ /' >> $GITHUB_OUTPUT
${{ inputs.path-filters }}
INPUT_EOF
echo "EOF" >> $GITHUB_OUTPUT
- uses: dorny/paths-filter@v3
id: changes
continue-on-error: true
with:
filters: |
src:
${{ inputs.path-filters }}
filters: ${{ steps.build-filters.outputs.yaml }}
build:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.src != 'false'
if: needs.changes.outputs.src == 'true'
name: PNPM Build
@@ -83,4 +91,4 @@ jobs:
steps:
- name: Summary status
run: if ${{ needs.changes.outputs.src != 'false' && needs.build.result != 'success' }}; then exit 1; fi
run: if ${{ needs.changes.outputs.src == 'true' && needs.build.result != 'success' }}; then exit 1; fi

View File

@@ -40,18 +40,26 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Build filters
id: build-filters
run: |
echo "yaml<<EOF" >> $GITHUB_OUTPUT
echo "src:" >> $GITHUB_OUTPUT
cat <<'INPUT_EOF' | sed 's/^/ /' >> $GITHUB_OUTPUT
${{ inputs.path-filters }}
INPUT_EOF
echo "EOF" >> $GITHUB_OUTPUT
- uses: dorny/paths-filter@v3
id: changes
continue-on-error: true
with:
filters: |
src:
${{ inputs.path-filters }}
filters: ${{ steps.build-filters.outputs.yaml }}
xml-linters:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.src != 'false'
if: needs.changes.outputs.src == 'true'
name: info.xml lint
steps:
@@ -79,4 +87,4 @@ jobs:
steps:
- name: Summary status
run: if ${{ needs.changes.outputs.src != 'false' && needs.xml-linters.result != 'success' }}; then exit 1; fi
run: if ${{ needs.changes.outputs.src == 'true' && needs.xml-linters.result != 'success' }}; then exit 1; fi

View File

@@ -41,18 +41,26 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Build filters
id: build-filters
run: |
echo "yaml<<EOF" >> $GITHUB_OUTPUT
echo "src:" >> $GITHUB_OUTPUT
cat <<'INPUT_EOF' | sed 's/^/ /' >> $GITHUB_OUTPUT
${{ inputs.path-filters }}
INPUT_EOF
echo "EOF" >> $GITHUB_OUTPUT
- uses: dorny/paths-filter@v3
id: changes
continue-on-error: true
with:
filters: |
src:
${{ inputs.path-filters }}
filters: ${{ steps.build-filters.outputs.yaml }}
lint:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.src != 'false'
if: needs.changes.outputs.src == 'true'
name: NPM lint
@@ -83,4 +91,4 @@ jobs:
steps:
- name: Summary status
run: if ${{ needs.changes.outputs.src != 'false' && needs.lint.result != 'success' }}; then exit 1; fi
run: if ${{ needs.changes.outputs.src == 'true' && needs.lint.result != 'success' }}; then exit 1; fi

View File

@@ -41,18 +41,26 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Build filters
id: build-filters
run: |
echo "yaml<<EOF" >> $GITHUB_OUTPUT
echo "src:" >> $GITHUB_OUTPUT
cat <<'INPUT_EOF' | sed 's/^/ /' >> $GITHUB_OUTPUT
${{ inputs.path-filters }}
INPUT_EOF
echo "EOF" >> $GITHUB_OUTPUT
- uses: dorny/paths-filter@v3
id: changes
continue-on-error: true
with:
filters: |
src:
${{ inputs.path-filters }}
filters: ${{ steps.build-filters.outputs.yaml }}
openapi:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.src != 'false' && github.repository_owner != 'nextcloud-gmbh'
if: needs.changes.outputs.src == 'true' && github.repository_owner != 'nextcloud-gmbh'
steps:
- name: Checkout
@@ -115,4 +123,4 @@ jobs:
steps:
- name: Summary status
run: if ${{ needs.changes.outputs.src != 'false' && needs.openapi.result != 'success' && needs.openapi.result != 'skipped' }}; then exit 1; fi
run: if ${{ needs.changes.outputs.src == 'true' && needs.openapi.result != 'success' && needs.openapi.result != 'skipped' }}; then exit 1; fi

View File

@@ -41,18 +41,26 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Build filters
id: build-filters
run: |
echo "yaml<<EOF" >> $GITHUB_OUTPUT
echo "src:" >> $GITHUB_OUTPUT
cat <<'INPUT_EOF' | sed 's/^/ /' >> $GITHUB_OUTPUT
${{ inputs.path-filters }}
INPUT_EOF
echo "EOF" >> $GITHUB_OUTPUT
- uses: dorny/paths-filter@v3
id: changes
continue-on-error: true
with:
filters: |
src:
${{ inputs.path-filters }}
filters: ${{ steps.build-filters.outputs.yaml }}
lint:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.src != 'false'
if: needs.changes.outputs.src == 'true'
name: php-cs
@@ -92,4 +100,4 @@ jobs:
steps:
- name: Summary status
run: if ${{ needs.changes.outputs.src != 'false' && needs.lint.result != 'success' }}; then exit 1; fi
run: if ${{ needs.changes.outputs.src == 'true' && needs.lint.result != 'success' }}; then exit 1; fi

View File

@@ -40,18 +40,26 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Build filters
id: build-filters
run: |
echo "yaml<<EOF" >> $GITHUB_OUTPUT
echo "src:" >> $GITHUB_OUTPUT
cat <<'INPUT_EOF' | sed 's/^/ /' >> $GITHUB_OUTPUT
${{ inputs.path-filters }}
INPUT_EOF
echo "EOF" >> $GITHUB_OUTPUT
- uses: dorny/paths-filter@v3
id: changes
continue-on-error: true
with:
filters: |
src:
${{ inputs.path-filters }}
filters: ${{ steps.build-filters.outputs.yaml }}
matrix:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.src != 'false'
if: needs.changes.outputs.src == 'true'
outputs:
php-versions: ${{ steps.versions.outputs.php-versions }}
steps:
@@ -64,7 +72,7 @@ jobs:
php-lint:
runs-on: ubuntu-latest
needs: [changes, matrix]
if: needs.changes.outputs.src != 'false'
if: needs.changes.outputs.src == 'true'
strategy:
matrix:
php-versions: ${{fromJson(needs.matrix.outputs.php-versions)}}
@@ -100,4 +108,4 @@ jobs:
steps:
- name: Summary status
run: if ${{ needs.changes.outputs.src != 'false' && needs.php-lint.result != 'success' }}; then exit 1; fi
run: if ${{ needs.changes.outputs.src == 'true' && needs.php-lint.result != 'success' }}; then exit 1; fi

View File

@@ -61,18 +61,26 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Build filters
id: build-filters
run: |
echo "yaml<<EOF" >> $GITHUB_OUTPUT
echo "src:" >> $GITHUB_OUTPUT
cat <<'INPUT_EOF' | sed 's/^/ /' >> $GITHUB_OUTPUT
${{ inputs.path-filters }}
INPUT_EOF
echo "EOF" >> $GITHUB_OUTPUT
- uses: dorny/paths-filter@v3
id: changes
continue-on-error: true
with:
filters: |
src:
${{ inputs.path-filters }}
filters: ${{ steps.build-filters.outputs.yaml }}
incremental-pgsql:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.src != 'false'
if: needs.changes.outputs.src == 'true'
name: Incremental Migration (PostgreSQL)
@@ -217,7 +225,7 @@ jobs:
incremental-mysql:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.src != 'false'
if: needs.changes.outputs.src == 'true'
name: Incremental Migration (MySQL)
@@ -369,4 +377,4 @@ jobs:
steps:
- name: Summary status
run: if ${{ needs.changes.outputs.src != 'false' && (needs.incremental-pgsql.result != 'success' || needs.incremental-mysql.result != 'success') }}; then exit 1; fi
run: if ${{ needs.changes.outputs.src == 'true' && (needs.incremental-pgsql.result != 'success' || needs.incremental-mysql.result != 'success') }}; then exit 1; fi

View File

@@ -49,8 +49,36 @@ permissions:
contents: read
jobs:
changes:
runs-on: ubuntu-latest
outputs:
src: ${{ steps.changes.outputs.src }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build filters
id: build-filters
run: |
echo "yaml<<EOF" >> $GITHUB_OUTPUT
echo "src:" >> $GITHUB_OUTPUT
cat <<'INPUT_EOF' | sed 's/^/ /' >> $GITHUB_OUTPUT
${{ inputs.path-filters }}
INPUT_EOF
echo "EOF" >> $GITHUB_OUTPUT
- uses: dorny/paths-filter@v3
id: changes
continue-on-error: true
with:
filters: ${{ steps.build-filters.outputs.yaml }}
matrix:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.src == 'true'
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
@@ -77,29 +105,11 @@ jobs:
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
echo "Generated matrix: $MATRIX"
changes:
runs-on: ubuntu-latest
outputs:
src: ${{ steps.changes.outputs.src}}
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: changes
continue-on-error: true
with:
filters: |
src:
${{ inputs.path-filters }}
phpunit-mysql:
runs-on: ubuntu-latest
needs: [changes, matrix]
if: needs.changes.outputs.src != 'false'
if: needs.changes.outputs.src == 'true'
strategy:
matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
@@ -230,4 +240,4 @@ jobs:
steps:
- name: Summary status
run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-mysql.result != 'success' }}; then exit 1; fi
run: if ${{ needs.changes.outputs.src == 'true' && needs.phpunit-mysql.result != 'success' }}; then exit 1; fi

View File

@@ -39,8 +39,36 @@ permissions:
contents: read
jobs:
changes:
runs-on: ubuntu-latest
outputs:
src: ${{ steps.changes.outputs.src }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build filters
id: build-filters
run: |
echo "yaml<<EOF" >> $GITHUB_OUTPUT
echo "src:" >> $GITHUB_OUTPUT
cat <<'INPUT_EOF' | sed 's/^/ /' >> $GITHUB_OUTPUT
${{ inputs.path-filters }}
INPUT_EOF
echo "EOF" >> $GITHUB_OUTPUT
- uses: dorny/paths-filter@v3
id: changes
continue-on-error: true
with:
filters: ${{ steps.build-filters.outputs.yaml }}
matrix:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.src == 'true'
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
@@ -65,29 +93,11 @@ jobs:
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
echo "Generated matrix: $MATRIX"
changes:
runs-on: ubuntu-latest
outputs:
src: ${{ steps.changes.outputs.src }}
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: changes
continue-on-error: true
with:
filters: |
src:
${{ inputs.path-filters }}
phpunit-pgsql:
runs-on: ubuntu-latest
needs: [changes, matrix]
if: needs.changes.outputs.src != 'false'
if: needs.changes.outputs.src == 'true'
strategy:
matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
@@ -215,4 +225,4 @@ jobs:
steps:
- name: Summary status
run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-pgsql.result != 'success' }}; then exit 1; fi
run: if ${{ needs.changes.outputs.src == 'true' && needs.phpunit-pgsql.result != 'success' }}; then exit 1; fi

View File

@@ -41,18 +41,26 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Build filters
id: build-filters
run: |
echo "yaml<<EOF" >> $GITHUB_OUTPUT
echo "src:" >> $GITHUB_OUTPUT
cat <<'INPUT_EOF' | sed 's/^/ /' >> $GITHUB_OUTPUT
${{ inputs.path-filters }}
INPUT_EOF
echo "EOF" >> $GITHUB_OUTPUT
- uses: dorny/paths-filter@v3
id: changes
continue-on-error: true
with:
filters: |
src:
${{ inputs.path-filters }}
filters: ${{ steps.build-filters.outputs.yaml }}
matrix:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.src != 'false'
if: needs.changes.outputs.src == 'true'
outputs:
ocp-matrix: ${{ steps.versions.outputs.ocp-matrix }}
steps:
@@ -65,7 +73,7 @@ jobs:
static-analysis:
runs-on: ubuntu-latest
needs: [changes, matrix]
if: needs.changes.outputs.src != 'false'
if: needs.changes.outputs.src == 'true'
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix.outputs.ocp-matrix) }}
@@ -104,4 +112,4 @@ jobs:
steps:
- name: Summary status
run: if ${{ needs.changes.outputs.src != 'false' && needs.static-analysis.result != 'success' }}; then exit 1; fi
run: if ${{ needs.changes.outputs.src == 'true' && needs.static-analysis.result != 'success' }}; then exit 1; fi

View File

@@ -47,18 +47,26 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Build filters
id: build-filters
run: |
echo "yaml<<EOF" >> $GITHUB_OUTPUT
echo "src:" >> $GITHUB_OUTPUT
cat <<'INPUT_EOF' | sed 's/^/ /' >> $GITHUB_OUTPUT
${{ inputs.path-filters }}
INPUT_EOF
echo "EOF" >> $GITHUB_OUTPUT
- uses: dorny/paths-filter@v3
id: changes
continue-on-error: true
with:
filters: |
src:
${{ inputs.path-filters }}
filters: ${{ steps.build-filters.outputs.yaml }}
vitest:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.src != 'false'
if: needs.changes.outputs.src == 'true'
name: Vitest
@@ -109,4 +117,4 @@ jobs:
steps:
- name: Summary status
run: if ${{ needs.changes.outputs.src != 'false' && needs.vitest.result != 'success' }}; then exit 1; fi
run: if ${{ needs.changes.outputs.src == 'true' && needs.vitest.result != 'success' }}; then exit 1; fi

View File

@@ -14,25 +14,23 @@ help:
tag:
ifndef TAG
$(error TAG is required. Usage: make tag TAG=<name> [VERSION=<number>])
endif
@read -p "Enter tag name: " tag_input; \
if [ -z "$$tag_input" ]; then \
echo "Error: TAG is required"; \
exit 1; \
fi; \
$(MAKE) tag TAG=$$tag_input $(if $(VERSION),VERSION=$(VERSION),)
else
@# Auto-detect version if not provided
$(eval VERSION ?= $(shell \
$(eval _detected_version := $(shell \
latest=$$(git tag --list '$(TAG)-v*' | sed 's/$(TAG)-v//' | sort -n | tail -1); \
if [ -z "$$latest" ]; then echo 1; else echo $$((latest + 1)); fi \
))
@# Get latest global version
$(eval GLOBAL_VERSION := $(shell \
latest=$$(git tag --list 'v*' | grep -E '^v[0-9]+$$' | sed 's/v//' | sort -n | tail -1); \
if [ -z "$$latest" ]; then echo 1; else echo $$((latest + 1)); fi \
))
$(eval VERSION := $(or $(VERSION),$(_detected_version)))
@echo "Tagging with:"
@echo " Global version: v$(GLOBAL_VERSION)"
@echo " Tag version: $(TAG)-v$(VERSION)"
@echo " Latest tag: $(TAG)-latest"
@echo ""
@# Create global version tag
git tag -f v$(GLOBAL_VERSION)
@# Create tag-specific version
git tag -f $(TAG)-v$(VERSION)
@# Remove old latest tag and re-create
@@ -40,4 +38,12 @@ endif
git tag $(TAG)-latest
@echo ""
@echo "Tags created successfully!"
@echo "To push tags, run: git push origin v$(GLOBAL_VERSION) $(TAG)-v$(VERSION) $(TAG)-latest --force"
@read -p "Push tags to remote? [Y/n] " answer; \
answer=$${answer:-y}; \
if echo "$$answer" | grep -iq "^y"; then \
echo "Pushing tags to remote..."; \
git push origin $(TAG)-v$(VERSION) $(TAG)-latest --force; \
else \
echo "To push tags later, run: git push origin $(TAG)-v$(VERSION) $(TAG)-latest --force"; \
fi
endif

332
README.md
View File

@@ -2,6 +2,26 @@
A collection of reusable GitHub Actions workflows.
## Table of Contents
- [Workflows](#workflows)
- [Go Release](#go-release-go-releaseyml)
- [Manual Homebrew Release](#manual-homebrew-release-manual-homebrew-releaseyml)
- [Nextcloud Workflows](#nextcloud-workflows)
- [PHPUnit MySQL](#phpunit-mysql-nextcloud-phpunit-mysqlyml)
- [PHPUnit PostgreSQL](#phpunit-postgresql-nextcloud-phpunit-pgsqlyml)
- [PHPUnit Incremental Migration](#phpunit-incremental-migration-nextcloud-phpunit-incrementalyml)
- [Psalm Static Analysis](#psalm-static-analysis-nextcloud-psalmyml)
- [PHP Lint](#php-lint-nextcloud-lint-phpyml)
- [PHP-CS-Fixer](#php-cs-fixer-nextcloud-lint-php-csyml)
- [ESLint](#eslint-nextcloud-lint-eslintyml)
- [OpenAPI Lint](#openapi-lint-nextcloud-lint-openapiyml)
- [AppInfo XML Lint](#appinfo-xml-lint-nextcloud-lint-appinfo-xmlyml)
- [NPM Build](#npm-build-nextcloud-build-npmyml)
- [Vitest](#vitest-nextcloud-vitestyml)
- [Block Unconventional Commits](#block-unconventional-commits-nextcloud-block-unconventional-commitsyml)
- [License](#license)
## Workflows
### Go Release (`go-release.yml`)
@@ -29,9 +49,13 @@ on:
jobs:
release:
uses: chenasraf/workflows/.github/workflows/go-release.yml@main
uses: chenasraf/workflows/.github/workflows/go-release.yml@master
with:
name: my-binary
name: my-cli
go-version: '1.24'
platforms: '["linux/amd64", "darwin/arm64"]'
main-branch: main
homebrew-tap-repo: myorg/homebrew-tap
secrets:
REPO_DISPATCH_PAT: ${{ secrets.REPO_DISPATCH_PAT }}
```
@@ -56,22 +80,312 @@ jobs:
| ------------------- | ---------------------------------------- | -------- |
| `REPO_DISPATCH_PAT` | PAT for dispatching to homebrew tap repo | No |
#### Example with Custom Options
---
### 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
```yaml
name: Manual Homebrew Release
on:
workflow_dispatch:
jobs:
release:
uses: chenasraf/workflows/.github/workflows/go-release.yml@master
homebrew:
uses: chenasraf/workflows/.github/workflows/manual-homebrew-release.yml@master
with:
name: my-cli
go-version: '1.24'
platforms: '["linux/amd64", "darwin/arm64"]'
main-branch: main
homebrew-tap-repo: myorg/homebrew-tap
secrets:
REPO_DISPATCH_PAT: ${{ secrets.REPO_DISPATCH_PAT }}
```
#### Inputs
| Input | Description | Required | Default |
| ------------------- | ------------------------------------------------ | -------- | ------- |
| `homebrew-tap-repo` | Homebrew tap repo to dispatch to (e.g., owner/homebrew-tap) | Yes | - |
#### Secrets
| Secret | Description | Required |
| ------------------- | ---------------------------------------- | -------- |
| `REPO_DISPATCH_PAT` | PAT for dispatching to homebrew tap repo | Yes |
---
## 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.
```yaml
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'
```
| Input | Description | Required | Default |
|-------|-------------|----------|---------|
| `php-versions-min` | Minimum PHP version | No | `8.2` |
| `php-versions-max` | Maximum PHP version | No | `8.3` |
| `mysql-version` | MySQL version | No | `8.4` |
| `php-extensions` | PHP extensions to install | No | _(common extensions)_ |
| `path-filters` | Paths to trigger on (YAML list) | No | _(lib, tests, etc.)_ |
### PHPUnit PostgreSQL (`nextcloud-phpunit-pgsql.yml`)
Runs PHPUnit tests with PostgreSQL database.
```yaml
jobs:
phpunit:
uses: chenasraf/workflows/.github/workflows/nextcloud-phpunit-pgsql.yml@nextcloud-latest
with:
php-version: '8.2'
path-filters: |
- 'lib/**'
- 'tests/**'
```
| Input | Description | Required | Default |
|-------|-------------|----------|---------|
| `php-version` | PHP version | No | `8.3` |
| `php-extensions` | PHP extensions to install | No | _(common extensions)_ |
| `path-filters` | Paths 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.
```yaml
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'
```
| Input | Description | Required | Default |
|-------|-------------|----------|---------|
| `baseline-version` | Git tag/ref to upgrade from | Yes | - |
| `php-version` | PHP version | No | `8.3` |
| `php-extensions-mysql` | PHP extensions for MySQL tests | No | _(common extensions)_ |
| `php-extensions-pgsql` | PHP extensions for PostgreSQL tests | No | _(common extensions)_ |
| `validation-query` | SQL query to validate migration | No | _(empty)_ |
| `path-filters` | Paths to trigger on (YAML list) | No | _(lib, tests, etc.)_ |
### Psalm Static Analysis (`nextcloud-psalm.yml`)
Runs Psalm static analysis across supported Nextcloud versions.
```yaml
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'
```
| Input | Description | Required | Default |
|-------|-------------|----------|---------|
| `psalm-command` | Command to run Psalm | No | `composer run psalm` |
| `php-extensions` | PHP extensions to install | No | _(common extensions)_ |
| `path-filters` | Paths to trigger on (YAML list) | No | `**.php`, `psalm.xml` |
### PHP Lint (`nextcloud-lint-php.yml`)
Runs PHP syntax linting across supported PHP versions.
```yaml
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'
```
| Input | Description | Required | Default |
|-------|-------------|----------|---------|
| `lint-command` | Command to run lint | No | `composer run lint` |
| `php-extensions` | PHP extensions to install | No | _(common extensions)_ |
| `path-filters` | Paths to trigger on (YAML list) | No | `**.php` |
### PHP-CS-Fixer (`nextcloud-lint-php-cs.yml`)
Checks PHP code style with PHP-CS-Fixer.
```yaml
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'
```
| Input | Description | Required | Default |
|-------|-------------|----------|---------|
| `cs-check-command` | Command to check code style | No | `composer run cs:check` |
| `php-extensions` | PHP extensions to install | No | _(common extensions)_ |
| `path-filters` | Paths to trigger on (YAML list) | No | `**.php`, `.php-cs-fixer.dist.php` |
### ESLint (`nextcloud-lint-eslint.yml`)
Runs ESLint on frontend code.
```yaml
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'
```
| Input | Description | Required | Default |
|-------|-------------|----------|---------|
| `lint-command` | Command to run lint | No | `pnpm lint` |
| `path-filters` | Paths to trigger on (YAML list) | No | `src/**`, `*.ts`, `*.js`, etc. |
### OpenAPI Lint (`nextcloud-lint-openapi.yml`)
Validates OpenAPI spec is up to date.
```yaml
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'
```
| Input | Description | Required | Default |
|-------|-------------|----------|---------|
| `openapi-command` | Command to regenerate OpenAPI | No | `composer run openapi` |
| `typescript-types-pattern` | Glob for TypeScript types | No | `src/types/openapi/openapi*.ts` |
| `path-filters` | Paths to trigger on (YAML list) | No | `lib/**/*.php`, `openapi.json` |
### AppInfo XML Lint (`nextcloud-lint-appinfo-xml.yml`)
Validates `appinfo/info.xml` against schema.
```yaml
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'
```
| Input | Description | Required | Default |
|-------|-------------|----------|---------|
| `xml-file` | Path to the info.xml file | No | `./appinfo/info.xml` |
| `schema-url` | URL to XML schema | No | _(Nextcloud schema)_ |
| `path-filters` | Paths to trigger on (YAML list) | No | `appinfo/info.xml` |
### NPM Build (`nextcloud-build-npm.yml`)
Builds frontend assets with pnpm.
```yaml
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'
```
| Input | Description | Required | Default |
|-------|-------------|----------|---------|
| `build-command` | Command to run build | No | `pnpm build` |
| `path-filters` | Paths to trigger on (YAML list) | No | `src/**`, `*.json`, etc. |
### Vitest (`nextcloud-vitest.yml`)
Runs Vitest frontend tests.
```yaml
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/**'
```
| Input | Description | Required | Default |
|-------|-------------|----------|---------|
| `node-version` | Node.js version to use | No | `22` |
| `test-command` | Command to run tests | No | `pnpm test:run` |
| `path-filters` | Paths to trigger on (YAML list) | No | `src/**`, `*.ts`, etc. |
### Block Unconventional Commits (`nextcloud-block-unconventional-commits.yml`)
Blocks commits that don't follow conventional commit format.
```yaml
jobs:
commits:
uses: chenasraf/workflows/.github/workflows/nextcloud-block-unconventional-commits.yml@nextcloud-latest
with:
allowed-types: 'feat,fix,docs,chore,refactor'
```
| Input | Description | Required | Default |
|-------|-------------|----------|---------|
| `allowed-types` | Comma-separated list of allowed commit types | No | _(feat, fix, docs, etc.)_ |
---
## License
MIT