From 9f7712a3b4e93c43b2743d03df2e2225a0fa29e8 Mon Sep 17 00:00:00 2001 From: "Garen J. Torikian" Date: Wed, 4 Mar 2026 13:13:39 -0500 Subject: [PATCH 1/4] ci: add release-please for automated releases Co-Authored-By: Claude Opus 4.6 --- .github/workflows/lint-pr-title.yml | 16 ++++++ .github/workflows/release-please.yml | 25 +++++++++ .github/workflows/release.yml | 41 -------------- .github/workflows/version-bump.yml | 80 ---------------------------- .release-please-manifest.json | 3 ++ release-please-config.json | 11 ++++ 6 files changed, 55 insertions(+), 121 deletions(-) create mode 100644 .github/workflows/lint-pr-title.yml create mode 100644 .github/workflows/release-please.yml delete mode 100644 .github/workflows/release.yml delete mode 100644 .github/workflows/version-bump.yml create mode 100644 .release-please-manifest.json create mode 100644 release-please-config.json diff --git a/.github/workflows/lint-pr-title.yml b/.github/workflows/lint-pr-title.yml new file mode 100644 index 0000000..b8e96ff --- /dev/null +++ b/.github/workflows/lint-pr-title.yml @@ -0,0 +1,16 @@ +name: Lint PR Title + +on: + pull_request_target: + types: [opened, edited, synchronize] + +permissions: + pull-requests: read + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..d8efdc7 --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,25 @@ +name: Release Please + +on: + push: + branches: + - main + +permissions: + contents: write + pull-requests: write + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - name: Generate token + id: generate-token + uses: actions/create-github-app-token@v2 + with: + app-id: ${{ vars.SDK_BOT_APP_ID }} + private-key: ${{ secrets.SDK_BOT_PRIVATE_KEY }} + + - uses: googleapis/release-please-action@v4 + with: + token: ${{ steps.generate-token.outputs.token }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 91228aa..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Release - -on: - pull_request: - types: - - closed - branches: - - main - -jobs: - release: - if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'version-bump') - runs-on: ubuntu-latest - steps: - - name: Generate GitHub App token - id: app-token - uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1 - with: - app-id: ${{ vars.SDK_BOT_APP_ID }} - private-key: ${{ secrets.SDK_BOT_PRIVATE_KEY }} - - - name: Checkout repository - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - token: ${{ steps.app-token.outputs.token }} - fetch-depth: 0 - - - name: Get version from Version.php - id: version - run: | - VERSION=$(grep -oP "SDK_VERSION = '\K[0-9]+\.[0-9]+\.[0-9]+" lib/Version.php) - echo "version=$VERSION" >> $GITHUB_OUTPUT - - - name: Create Release - uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0 - with: - token: ${{ steps.app-token.outputs.token }} - tag_name: ${{ steps.version.outputs.version }} - name: ${{ steps.version.outputs.version }} - generate_release_notes: true - make_latest: true diff --git a/.github/workflows/version-bump.yml b/.github/workflows/version-bump.yml deleted file mode 100644 index c0b9da3..0000000 --- a/.github/workflows/version-bump.yml +++ /dev/null @@ -1,80 +0,0 @@ -name: Version Bump - -on: - workflow_dispatch: - inputs: - bump_type: - description: 'Version bump type' - required: true - type: choice - options: - - patch - - minor - - major - -jobs: - bump-version: - runs-on: ubuntu-latest - steps: - - name: Generate GitHub App token - id: app-token - uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1 - with: - app-id: ${{ vars.SDK_BOT_APP_ID }} - private-key: ${{ secrets.SDK_BOT_PRIVATE_KEY }} - - - name: Checkout repository - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - token: ${{ steps.app-token.outputs.token }} - - - name: Configure Git - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - - - name: Bump version - id: bump - run: | - VERSION_FILE="lib/Version.php" - OLD_VERSION=$(grep -oP "SDK_VERSION = '\K[0-9]+\.[0-9]+\.[0-9]+" "$VERSION_FILE") - - IFS='.' read -r MAJOR MINOR PATCH <<< "$OLD_VERSION" - - case "${{ inputs.bump_type }}" in - major) - MAJOR=$((MAJOR + 1)) - MINOR=0 - PATCH=0 - ;; - minor) - MINOR=$((MINOR + 1)) - PATCH=0 - ;; - patch) - PATCH=$((PATCH + 1)) - ;; - esac - - NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}" - - sed -i "s/SDK_VERSION = '$OLD_VERSION'/SDK_VERSION = '$NEW_VERSION'/" "$VERSION_FILE" - - echo "old_version=$OLD_VERSION" >> $GITHUB_OUTPUT - echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT - - - name: Create Pull Request - uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0 - with: - token: ${{ steps.app-token.outputs.token }} - branch: version-bump-${{ steps.bump.outputs.new_version }} - commit-message: "Bump version from ${{ steps.bump.outputs.old_version }} to ${{ steps.bump.outputs.new_version }}" - title: "Bump version to ${{ steps.bump.outputs.new_version }}" - body: | - This PR bumps the version from `${{ steps.bump.outputs.old_version }}` to `${{ steps.bump.outputs.new_version }}`. - - **Bump type:** ${{ inputs.bump_type }} - - --- - *This PR was automatically created by the version bump workflow.* - labels: version-bump diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..8add9ca --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "4.30.1" +} diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..adbc0d4 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "packages": { + ".": { + "release-type": "php", + "package-name": "workos/workos-php", + "version-file": "lib/Version.php", + "changelog-path": "CHANGELOG.md" + } + } +} From 3c7397cc91f6bf3727ddf229a190574620bb99ab Mon Sep 17 00:00:00 2001 From: "Garen J. Torikian" Date: Wed, 4 Mar 2026 13:15:13 -0500 Subject: [PATCH 2/4] Pin to GitHub SHAs --- .github/workflows/lint-pr-title.yml | 2 +- .github/workflows/release-please.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint-pr-title.yml b/.github/workflows/lint-pr-title.yml index b8e96ff..44bdad6 100644 --- a/.github/workflows/lint-pr-title.yml +++ b/.github/workflows/lint-pr-title.yml @@ -11,6 +11,6 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: amannn/action-semantic-pull-request@v5 + - uses: amannn/action-semantic-pull-request@e32d7e603df1aa1ba07e981f2a23455dee596825 # v5 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index d8efdc7..f727f27 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -15,11 +15,11 @@ jobs: steps: - name: Generate token id: generate-token - uses: actions/create-github-app-token@v2 + uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1 with: app-id: ${{ vars.SDK_BOT_APP_ID }} private-key: ${{ secrets.SDK_BOT_PRIVATE_KEY }} - - uses: googleapis/release-please-action@v4 + - uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4.4.0 with: token: ${{ steps.generate-token.outputs.token }} From dce4b2a260b36b68716868ff2db83439786e1458 Mon Sep 17 00:00:00 2001 From: "Garen J. Torikian" Date: Wed, 4 Mar 2026 13:18:55 -0500 Subject: [PATCH 3/4] call it `lint_title` --- .github/workflows/lint-pr-title.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint-pr-title.yml b/.github/workflows/lint-pr-title.yml index 44bdad6..764d4e6 100644 --- a/.github/workflows/lint-pr-title.yml +++ b/.github/workflows/lint-pr-title.yml @@ -8,7 +8,7 @@ permissions: pull-requests: read jobs: - lint: + lint_title: runs-on: ubuntu-latest steps: - uses: amannn/action-semantic-pull-request@e32d7e603df1aa1ba07e981f2a23455dee596825 # v5 From 91cf26ccff45fe41dcfb944b204e5d3e6a28f5b2 Mon Sep 17 00:00:00 2001 From: "Garen J. Torikian" Date: Wed, 4 Mar 2026 13:19:23 -0500 Subject: [PATCH 4/4] fix: use extra-files with generic updater for Version.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `version-file` option is only supported by `ruby` and `simple` strategies — it's silently ignored for `release-type: php`. Use `extra-files` with the `generic` updater instead, which matches the `x-release-please-version` annotation comment to find and replace the semver string. Co-Authored-By: Claude Opus 4.6 --- lib/Version.php | 2 +- release-please-config.json | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/Version.php b/lib/Version.php index c7a0b65..42ed052 100644 --- a/lib/Version.php +++ b/lib/Version.php @@ -6,5 +6,5 @@ final class Version { public const SDK_IDENTIFIER = 'WorkOS PHP'; - public const SDK_VERSION = '4.30.1'; + public const SDK_VERSION = '4.30.1'; // x-release-please-version } diff --git a/release-please-config.json b/release-please-config.json index adbc0d4..1449c3f 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -4,8 +4,13 @@ ".": { "release-type": "php", "package-name": "workos/workos-php", - "version-file": "lib/Version.php", - "changelog-path": "CHANGELOG.md" + "changelog-path": "CHANGELOG.md", + "extra-files": [ + { + "type": "generic", + "path": "lib/Version.php" + } + ] } } }