chore: add GitHub workflows, issue templates, and changelog
- Tests, Pint, Release, Changelog, Auto-merge, Deploy Docs workflows - Bug report template, security policy, contributing guide - Dependabot config for GitHub Actions - Remove .idea from tracking - Keep only premium packages in ecosystem section
This commit is contained in:
33
.github/workflows/auto-merge.yml
vendored
Normal file
33
.github/workflows/auto-merge.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
name: Auto-Merge
|
||||
|
||||
on: pull_request_target
|
||||
|
||||
permissions:
|
||||
pull-requests: write
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
dependabot:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.actor == 'dependabot[bot]' }}
|
||||
steps:
|
||||
|
||||
- name: Dependabot metadata
|
||||
id: metadata
|
||||
uses: dependabot/fetch-metadata@v2.5.0
|
||||
with:
|
||||
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
|
||||
- name: Auto-merge Dependabot PRs for semver-minor updates
|
||||
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor'}}
|
||||
run: gh pr merge --auto --merge "$PR_URL"
|
||||
env:
|
||||
PR_URL: ${{github.event.pull_request.html_url}}
|
||||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||
|
||||
- name: Auto-merge Dependabot PRs for semver-patch updates
|
||||
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
|
||||
run: gh pr merge --auto --merge "$PR_URL"
|
||||
env:
|
||||
PR_URL: ${{github.event.pull_request.html_url}}
|
||||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||
42
.github/workflows/changelog.yml
vendored
Normal file
42
.github/workflows/changelog.yml
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
name: Changelog
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [released]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
update:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Determine target branch
|
||||
id: branch
|
||||
run: |
|
||||
TAG="${{ github.event.release.tag_name }}"
|
||||
MAJOR=$(echo "$TAG" | sed -E 's/^v?([0-9]+)\..*/\1/')
|
||||
BRANCH="${MAJOR}.x"
|
||||
if ! git ls-remote --exit-code --heads "https://github.com/${{ github.repository }}" "$BRANCH" > /dev/null 2>&1; then
|
||||
BRANCH="${{ github.event.repository.default_branch }}"
|
||||
fi
|
||||
echo "name=${BRANCH}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ steps.branch.outputs.name }}
|
||||
|
||||
- name: Update Changelog
|
||||
uses: stefanzweifel/changelog-updater-action@v1
|
||||
with:
|
||||
latest-version: ${{ github.event.release.name }}
|
||||
release-notes: ${{ github.event.release.body }}
|
||||
|
||||
- name: Commit updated CHANGELOG
|
||||
uses: stefanzweifel/git-auto-commit-action@v7
|
||||
with:
|
||||
branch: ${{ steps.branch.outputs.name }}
|
||||
commit_message: Update CHANGELOG
|
||||
file_pattern: CHANGELOG.md
|
||||
137
.github/workflows/deploy-docs.yml
vendored
Normal file
137
.github/workflows/deploy-docs.yml
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
name: Deploy Docs
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["1.x"]
|
||||
paths:
|
||||
- 'docs/**'
|
||||
- '.github/workflows/deploy-docs.yml'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: 'Version branch to deploy (e.g., 1.x)'
|
||||
required: true
|
||||
type: choice
|
||||
options:
|
||||
- '1.x'
|
||||
|
||||
# Prevent concurrent deploys to avoid push conflicts
|
||||
concurrency:
|
||||
group: deploy-docs
|
||||
cancel-in-progress: false
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Determine version
|
||||
id: version
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
|
||||
echo "branch=${{ inputs.version }}" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Set version config
|
||||
id: config
|
||||
run: |
|
||||
BRANCH="${{ steps.version.outputs.branch }}"
|
||||
case $BRANCH in
|
||||
1.x)
|
||||
echo "dest_folder=." >> $GITHUB_OUTPUT
|
||||
echo "base_url=/comments/" >> $GITHUB_OUTPUT
|
||||
echo "is_latest=true" >> $GITHUB_OUTPUT
|
||||
;;
|
||||
*)
|
||||
echo "Unknown branch: $BRANCH"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
- name: Checkout source branch
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ steps.version.outputs.branch }}
|
||||
|
||||
- name: Checkout gh-pages
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
ref: gh-pages
|
||||
path: gh-pages
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: 'docs/package-lock.json'
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: ./docs
|
||||
run: npm ci
|
||||
|
||||
- name: Build documentation
|
||||
working-directory: ./docs
|
||||
run: npm run generate
|
||||
env:
|
||||
NUXT_APP_BASE_URL: ${{ steps.config.outputs.base_url }}
|
||||
NUXT_SITE_URL: https://relaticle.github.io
|
||||
DOCS_VERSION: ${{ steps.version.outputs.branch }}
|
||||
NUXT_PUBLIC_FATHOM_SITE_ID: ${{ secrets.FATHOM_SITE_ID }}
|
||||
|
||||
- name: Deploy to gh-pages
|
||||
run: |
|
||||
DEST="${{ steps.config.outputs.dest_folder }}"
|
||||
IS_LATEST="${{ steps.config.outputs.is_latest }}"
|
||||
|
||||
if [ "$IS_LATEST" == "true" ]; then
|
||||
echo "Deploying latest version to root..."
|
||||
cd gh-pages
|
||||
# List of items to preserve
|
||||
PRESERVE="versions.json .nojekyll README.md .git"
|
||||
# Remove everything except preserved items
|
||||
for item in *; do
|
||||
if [ -e "$item" ]; then
|
||||
SKIP=false
|
||||
for keep in $PRESERVE; do
|
||||
if [ "$item" == "$keep" ]; then
|
||||
SKIP=true
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ "$SKIP" == "false" ]; then
|
||||
rm -rf "$item"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
# Also remove hidden files except .git, .nojekyll
|
||||
for item in .[!.]*; do
|
||||
if [ -e "$item" ] && [ "$item" != ".git" ] && [ "$item" != ".nojekyll" ]; then
|
||||
rm -rf "$item"
|
||||
fi
|
||||
done
|
||||
cd ..
|
||||
# Copy new build to root
|
||||
cp -r docs/.output/public/* gh-pages/
|
||||
else
|
||||
echo "Deploying to $DEST subfolder..."
|
||||
rm -rf "gh-pages/$DEST"
|
||||
cp -r docs/.output/public "gh-pages/$DEST"
|
||||
fi
|
||||
|
||||
- name: Commit and push
|
||||
working-directory: ./gh-pages
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add -A
|
||||
if git diff --staged --quiet; then
|
||||
echo "No changes to deploy"
|
||||
else
|
||||
git commit -m "Deploy ${{ steps.version.outputs.branch }} docs"
|
||||
git push
|
||||
fi
|
||||
27
.github/workflows/pint.yml
vendored
Normal file
27
.github/workflows/pint.yml
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
name: Pint
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- '**.php'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
php-code-styling:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ github.head_ref }}
|
||||
|
||||
- name: Fix PHP code style issues
|
||||
uses: aglipanci/laravel-pint-action@2.6
|
||||
|
||||
- name: Commit changes
|
||||
uses: stefanzweifel/git-auto-commit-action@v7
|
||||
with:
|
||||
commit_message: Fix styling
|
||||
51
.github/workflows/release.yml
vendored
Normal file
51
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*.*.*'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
uses: ./.github/workflows/tests.yml
|
||||
secrets: inherit
|
||||
|
||||
release:
|
||||
needs: tests
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Determine if pre-release
|
||||
id: prerelease
|
||||
run: |
|
||||
TAG="${{ github.ref_name }}"
|
||||
if [[ "$TAG" == *"-"* ]]; then
|
||||
echo "flag=--prerelease" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "flag=" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Create GitHub Release
|
||||
run: gh release create "${{ github.ref_name }}" --generate-notes ${{ steps.prerelease.outputs.flag }}
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
cleanup:
|
||||
needs: tests
|
||||
if: failure()
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Delete tag on test failure
|
||||
run: git push --delete origin "${{ github.ref_name }}"
|
||||
51
.github/workflows/tests.yml
vendored
Normal file
51
.github/workflows/tests.yml
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
name: Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [1.x]
|
||||
pull_request:
|
||||
branches: [1.x]
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
php: [8.2, 8.3, 8.4]
|
||||
laravel: [12.*]
|
||||
stability: [prefer-stable]
|
||||
include:
|
||||
- laravel: 12.*
|
||||
testbench: 10.*
|
||||
|
||||
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php }}
|
||||
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
|
||||
coverage: xdebug
|
||||
|
||||
- name: Setup problem matchers
|
||||
run: |
|
||||
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
|
||||
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
|
||||
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
|
||||
|
||||
- name: List Installed Dependencies
|
||||
run: composer show -D
|
||||
|
||||
- name: Execute tests
|
||||
run: vendor/bin/pest --ci
|
||||
Reference in New Issue
Block a user