Skip to content
Closed
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
155 changes: 0 additions & 155 deletions .github/workflows/release-prepare.yml

This file was deleted.

60 changes: 51 additions & 9 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ on:
types: [closed]
branches: [trunk]

concurrency:
group: release-publish
cancel-in-progress: false

jobs:
publish-release:
name: Publish draft release
name: Build plugin and create GitHub release
if: >-
github.repository == 'WordPress/sqlite-database-integration'
&& github.event.pull_request.merged == true
Expand All @@ -30,21 +34,59 @@ jobs:
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag=v$VERSION" >> $GITHUB_OUTPUT
- name: Publish draft release
# Versions with a hyphen (e.g., 2.3.0-beta.1) are prereleases.
if [[ "$VERSION" == *-* ]]; then
echo "prerelease=true" >> $GITHUB_OUTPUT
else
echo "prerelease=false" >> $GITHUB_OUTPUT
fi
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'

- name: Build plugin zip
run: composer run build-sqlite-plugin-zip

- name: Extract changelog from readme.txt
id: changelog
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
README="packages/plugin-sqlite-database-integration/readme.txt"
# Extract the changelog entry for this version.
CHANGELOG=$(awk -v version="$VERSION" '
$0 == "= " version " =" { found = 1; next }
found && /^= / { exit }
found { print }
' "$README" | sed -e '/./,$!d' -e :a -e '/^\s*$/{ $d; N; ba; }') # Trim leading/trailing blank lines.
{
echo "body<<CHANGELOG_EOF"
echo "$CHANGELOG"
echo "CHANGELOG_EOF"
} >> $GITHUB_OUTPUT
- name: Create GitHub release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ steps.version.outputs.tag }}
MERGE_SHA: ${{ github.event.pull_request.merge_commit_sha }}
BODY: ${{ steps.changelog.outputs.body }}
run: |
# Get the current release body and remove the PR note.
BODY=$(gh release view "$TAG" --json body --jq '.body' 2>/dev/null || echo "")
CLEAN_BODY=$(echo "$BODY" | grep -v "^> To publish the release, review and merge:")
PRERELEASE_FLAG=""
if [[ "${{ steps.version.outputs.prerelease }}" == "true" ]]; then
PRERELEASE_FLAG="--prerelease"
fi
# Publish the release, targeting the merge commit.
gh release edit "$TAG" \
--draft=false \
gh release create "$TAG" \
--target "$MERGE_SHA" \
--notes "$CLEAN_BODY"
--title "$TAG" \
--notes "$BODY" \
$PRERELEASE_FLAG \
"build/sqlite-database-integration.zip"
- name: Delete release branch
env:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/release-wporg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ concurrency:
jobs:
deploy:
name: Deploy plugin to WordPress.org
if: github.repository == 'WordPress/sqlite-database-integration'
if: >-
github.repository == 'WordPress/sqlite-database-integration'
&& github.event.release.prerelease == false
runs-on: ubuntu-latest
environment: WordPress.org
permissions:
Expand Down
32 changes: 20 additions & 12 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ composer install # Install dependencies
composer run check-cs # Check coding standards (PHPCS)
composer run fix-cs # Auto-fix coding standards (PHPCBF)
composer run build-sqlite-plugin-zip # Build the plugin zip
composer run prepare-release # Prepare a new release

# SQLite driver tests (under packages/mysql-on-sqlite)
cd packages/mysql-on-sqlite
Expand All @@ -69,18 +70,25 @@ composer run wp-test-clean # Clean up WordPress environment (Docker
```

## Release workflow
Release is automated with GitHub Actions. It requires only two manual steps:

1. **Create a draft release with a new tag and changelog.**
The `release-prepare` workflow will automatically:
- Use the draft tag to bump versions in `version.php`, `load.php`, and `readme.txt`.
- Add the draft release changelog entry to `readme.txt`.
- Build the plugin ZIP and attach it to the draft release.
- Create a PR (`release/<version>` → `trunk`) and link it in the draft release body.
2. **Review and merge the PR.**
The `release-publish` workflow will automatically:
- Publish the draft release.
- Publish the release artifact to WordPress.org.
Release is streamlined with a local preparation script and GitHub Actions:

1. **Run the release preparation script locally.**
```bash
composer run prepare-release -- <version>
```
The script will:
- Bump version numbers and generate a changelog from merged PRs.
- Create a `release/<version>` branch with a preparation commit.
- Push the branch and create a PR.

2. **Review the PR.**
Edit the changelog or push additional changes to the release branch.

3. **Mark as ready and merge the PR.**
The `release-publish` workflow will automatically:
- Build the plugin ZIP.
- Create and publish a GitHub release with the ZIP attached.
- Deploy the release to WordPress.org.

## Architecture
The project consists of multiple components providing different APIs that funnel
Expand Down
32 changes: 20 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ composer install # Install dependencies
composer run check-cs # Check coding standards (PHPCS)
composer run fix-cs # Auto-fix coding standards (PHPCBF)
composer run build-sqlite-plugin-zip # Build the plugin zip
composer run prepare-release # Prepare a new release

# SQLite driver tests (under packages/mysql-on-sqlite)
cd packages/mysql-on-sqlite
Expand All @@ -58,18 +59,25 @@ composer run wp-test-clean # Clean up WordPress environment (Docker
```

## Release workflow
Release is automated with GitHub Actions. It requires only two manual steps:

1. **Create a draft release with a new tag and changelog.**
The `release-prepare` workflow will automatically:
- Use the draft tag to bump versions in `version.php`, `load.php`, and `readme.txt`.
- Add the draft release changelog entry to `readme.txt`.
- Build the plugin ZIP and attach it to the draft release.
- Create a PR (`release/<version>` → `trunk`) and link it in the draft release body.
2. **Review and merge the PR.**
The `release-publish` workflow will automatically:
- Publish the draft release.
- Publish the release artifact to WordPress.org.
Release is streamlined with a local preparation script and GitHub Actions:

1. **Run the release preparation script locally.**
```bash
composer run prepare-release -- <version>
```
The script will:
- Bump version numbers and generate a changelog from merged PRs.
- Create a `release/<version>` branch with a preparation commit.
- Push the branch and create a PR.

2. **Review the PR.**
Edit the changelog or push additional changes to the release branch.

3. **Mark as ready and merge the PR.**
The `release-publish` workflow will automatically:
- Build the plugin ZIP.
- Create and publish a GitHub release with the ZIP attached.
- Deploy the release to WordPress.org.

## Architecture
The project consists of multiple components providing different APIs that funnel
Expand Down
Loading
Loading