Skip to content
Merged
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
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: CI

on:
schedule:
- cron: "0 0 * * *"
push:
branches: [ main, develop, feature/** ]
pull_request:
branches: [ main, develop, feature/** ]

permissions:
contents: read

jobs:
tests:
uses: myerscode/workflows/.github/workflows/php-tests.yml@v1
with:
php-versions: "['8.5']"
os: "['ubuntu-latest', 'macos-latest', 'windows-latest']"
extensions: "mbstring"

lint:
uses: myerscode/workflows/.github/workflows/php-lint.yml@v1
with:
php-version: "8.5"
extensions: "mbstring"

audit:
uses: myerscode/workflows/.github/workflows/php-security-audit.yml@v1
with:
php-version: "8.5"
extensions: "mbstring"

coverage:
uses: myerscode/workflows/.github/workflows/php-coverage.yml@v1
with:
php-version: "8.5"
extensions: "mbstring"
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
39 changes: 0 additions & 39 deletions .github/workflows/codecov.yml

This file was deleted.

121 changes: 10 additions & 111 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,122 +4,21 @@ on:
workflow_dispatch:
inputs:
version:
description: 'Version (e.g. 2026.0.0 or 1.2.3)'
description: 'CalVer version (e.g. 2026.0.0)'
required: true
type: string
scheme:
description: 'Version scheme'
required: true
type: choice
options:
- calver
- semver
default: calver

concurrency: ${{ github.workflow }}-${{ github.ref }}
push:
tags:
- '[0-9][0-9][0-9][0-9].*'

permissions:
contents: write
pull-requests: write

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
ref: main
fetch-depth: 0
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
persist-credentials: true

- name: Determine version and scheme
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
TAG="${{ github.event.inputs.version }}"
SCHEME="${{ github.event.inputs.scheme }}"
else
TAG="${GITHUB_REF_NAME}"
if echo "$TAG" | grep -qE '^[0-9]{4}\.[0-9]+\.[0-9]+$'; then
SCHEME="calver"
else
SCHEME="semver"
fi
fi
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "scheme=$SCHEME" >> "$GITHUB_OUTPUT"

- name: Validate version format
run: |
TAG="${{ steps.version.outputs.tag }}"
SCHEME="${{ steps.version.outputs.scheme }}"
if [ "$SCHEME" = "calver" ]; then
if ! echo "$TAG" | grep -qE '^[0-9]{4}\.[0-9]+\.[0-9]+$'; then
echo "Error: Version must be in CalVer format YYYY.MINOR.PATCH (e.g. 2026.0.0)"
exit 1
fi
else
if ! echo "$TAG" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "Error: Version must be in SemVer format MAJOR.MINOR.PATCH (e.g. 1.2.3)"
exit 1
fi
fi

- name: Create and push tag
if: github.event_name == 'workflow_dispatch'
run: |
git tag "${{ steps.version.outputs.tag }}"
git push origin "${{ steps.version.outputs.tag }}"

- name: Get previous tag
id: previous
run: |
CURRENT="${{ steps.version.outputs.tag }}"
PREVIOUS=$(git tag --list --sort=-version:refname '[0-9]*' | grep -v "^${CURRENT}$" | head -1)
if [ -n "$PREVIOUS" ]; then
echo "tag=$PREVIOUS" >> "$GITHUB_OUTPUT"
echo "found=true" >> "$GITHUB_OUTPUT"
else
echo "tag=" >> "$GITHUB_OUTPUT"
echo "found=false" >> "$GITHUB_OUTPUT"
fi

- name: Generate changelog
if: steps.previous.outputs.found == 'true'
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
fromTag: ${{ steps.version.outputs.tag }}
toTag: ${{ steps.previous.outputs.tag }}
excludeTypes: build,docs,other,style,ci,chore
useGitmojis: false
writeToFile: false

- name: Create GitHub release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ steps.version.outputs.tag }}
name: ${{ steps.version.outputs.tag }}
body: ${{ steps.changelog.outputs.changes || 'Initial release' }}

- name: Write changelog to file
if: steps.previous.outputs.found == 'true'
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
fromTag: ${{ steps.version.outputs.tag }}
toTag: ${{ steps.previous.outputs.tag }}
excludeTypes: build,docs,other,style,ci,chore
useGitmojis: false
writeToFile: true

- name: Commit updated CHANGELOG
if: steps.previous.outputs.found == 'true'
uses: stefanzweifel/git-auto-commit-action@v7
with:
branch: main
commit_message: "docs: update CHANGELOG for ${{ steps.version.outputs.tag }}"
file_pattern: CHANGELOG.md
uses: myerscode/workflows/.github/workflows/php-release.yml@v1
with:
version: ${{ github.event.inputs.version }}
scheme: calver
secrets:
PAT: ${{ secrets.PAT }}
28 changes: 0 additions & 28 deletions .github/workflows/security-audit.yml

This file was deleted.

34 changes: 0 additions & 34 deletions .github/workflows/tests.yml

This file was deleted.

20 changes: 20 additions & 0 deletions .github/workflows/update-changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Update Changelog

on:
workflow_dispatch:
inputs:
version:
description: 'Release version to regenerate changelog for'
required: true
type: string

permissions:
contents: write

jobs:
changelog:
uses: myerscode/workflows/.github/workflows/php-changelog.yml@v1
with:
version: ${{ github.event.inputs.version }}
secrets:
PAT: ${{ secrets.PAT }}
Loading