From 380d5788dfbe819658fb0efc34152ddfd759cff6 Mon Sep 17 00:00:00 2001 From: Subin Lee Date: Mon, 11 May 2026 09:33:29 +0900 Subject: [PATCH 1/2] =?UTF-8?q?ci:=20release-please=20=EB=8F=84=EC=9E=85?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EC=9E=90=EB=8F=99=20=EB=B2=84=EC=A0=84=20?= =?UTF-8?q?bump=C2=B7=EB=A6=B4=EB=A6=AC=EC=A6=88=20=ED=9D=90=EB=A6=84=20?= =?UTF-8?q?=EA=B5=AC=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 기존 release.yml은 머지된 PR이 composer.json 버전을 직접 bump하지 않으면 태그 충돌로 모든 release step이 skip되어 "성공"으로만 끝나는 한계가 있었다. master push 시 conventional commits를 분석해 버전 bump Release PR을 자동 생성하고, 해당 PR이 머지되면 태그·GitHub Release를 자동 발행하도록 변경한다. - .github/release-please-config.json: simple release-type, composer.json은 jsonpath updater, src/Models/Request/DefaultAgent.php는 generic updater - .github/.release-please-manifest.json: baseline 5.1.2 - .github/workflows/release-please.yml: master push 트리거 - DefaultAgent.php: x-release-please-version 마커 주석 추가 - 기존 release.yml 제거 Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/.release-please-manifest.json | 3 + .github/release-please-config.json | 26 +++++++ .github/workflows/release-please.yml | 21 ++++++ .github/workflows/release.yml | 97 --------------------------- src/Models/Request/DefaultAgent.php | 2 +- 5 files changed, 51 insertions(+), 98 deletions(-) create mode 100644 .github/.release-please-manifest.json create mode 100644 .github/release-please-config.json create mode 100644 .github/workflows/release-please.yml delete mode 100644 .github/workflows/release.yml diff --git a/.github/.release-please-manifest.json b/.github/.release-please-manifest.json new file mode 100644 index 0000000..5ceda3a --- /dev/null +++ b/.github/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "5.1.2" +} diff --git a/.github/release-please-config.json b/.github/release-please-config.json new file mode 100644 index 0000000..51c035e --- /dev/null +++ b/.github/release-please-config.json @@ -0,0 +1,26 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "packages": { + ".": { + "release-type": "simple", + "package-name": "solapi/sdk", + "include-component-in-tag": false, + "include-v-in-tag": true, + "tag-separator": "", + "draft": false, + "prerelease": false, + "changelog-path": "CHANGELOG.md", + "extra-files": [ + { + "type": "json", + "path": "composer.json", + "jsonpath": "$.version" + }, + { + "type": "generic", + "path": "src/Models/Request/DefaultAgent.php" + } + ] + } + } +} diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..58c0cd9 --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,21 @@ +name: release-please + +on: + push: + branches: + - master + +permissions: + contents: write + pull-requests: write + +jobs: + release-please: + name: Run release-please + runs-on: ubuntu-latest + steps: + - name: Run release-please + uses: googleapis/release-please-action@v4 + with: + config-file: .github/release-please-config.json + manifest-file: .github/.release-please-manifest.json diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index a429c31..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,97 +0,0 @@ -name: Release - -on: - workflow_run: - workflows: ["CI"] - types: [completed] - branches: [master] - -permissions: - contents: write - pull-requests: read - -jobs: - release: - name: Tag & GitHub Release - runs-on: ubuntu-latest - if: > - github.event.workflow_run.conclusion == 'success' && - github.event.workflow_run.head_branch == 'master' && - github.event.workflow_run.event == 'push' - - steps: - - name: Checkout CI head commit - uses: actions/checkout@v4 - with: - ref: ${{ github.event.workflow_run.head_sha }} - fetch-depth: 0 - - - name: Extract version from composer.json - id: version - run: | - set -euo pipefail - VERSION=$(jq -r '.version' composer.json) - if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - echo "::error::composer.json version '$VERSION' is not a plain semver (X.Y.Z). Pre-release tags are not supported by this workflow." - exit 1 - fi - echo "version=$VERSION" >> "$GITHUB_OUTPUT" - echo "tag=v$VERSION" >> "$GITHUB_OUTPUT" - echo "Detected version: $VERSION" - - - name: Verify DefaultAgent.php version matches composer.json - env: - VERSION: ${{ steps.version.outputs.version }} - run: | - set -euo pipefail - AGENT_FILE="src/Models/Request/DefaultAgent.php" - AGENT_VERSION=$(grep -oE "php/[0-9]+\.[0-9]+\.[0-9]+" "$AGENT_FILE" | head -n1 | sed 's|php/||') - if [ -z "$AGENT_VERSION" ]; then - echo "::error file=$AGENT_FILE::Could not locate 'php/X.Y.Z' SDK version literal in $AGENT_FILE." - exit 1 - fi - if [ "$VERSION" != "$AGENT_VERSION" ]; then - echo "::error file=$AGENT_FILE::Version drift detected. composer.json='$VERSION' but $AGENT_FILE='$AGENT_VERSION'. Update both files to the same value." - exit 1 - fi - echo "Version drift check passed: $VERSION" - - - name: Check whether tag already exists - id: tag-check - env: - TAG: ${{ steps.version.outputs.tag }} - run: | - set -euo pipefail - git fetch --tags --quiet - if git rev-parse -q --verify "refs/tags/${TAG}" >/dev/null; then - echo "exists=true" >> "$GITHUB_OUTPUT" - echo "Tag ${TAG} already exists — nothing to release. Skipping." - else - echo "exists=false" >> "$GITHUB_OUTPUT" - echo "Tag ${TAG} does not exist — proceeding with release." - fi - - - name: Configure git identity - if: steps.tag-check.outputs.exists == 'false' - run: | - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - - - name: Create and push tag - if: steps.tag-check.outputs.exists == 'false' - env: - TAG: ${{ steps.version.outputs.tag }} - run: | - set -euo pipefail - git tag -a "$TAG" -m "Release $TAG" - git push origin "$TAG" - - - name: Create GitHub Release - if: steps.tag-check.outputs.exists == 'false' - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - TAG: ${{ steps.version.outputs.tag }} - run: | - gh release create "$TAG" \ - --title "$TAG" \ - --generate-notes diff --git a/src/Models/Request/DefaultAgent.php b/src/Models/Request/DefaultAgent.php index 69f7871..5727a21 100644 --- a/src/Models/Request/DefaultAgent.php +++ b/src/Models/Request/DefaultAgent.php @@ -16,7 +16,7 @@ class DefaultAgent public function __construct() { - $this->sdkVersion = 'php/5.1.2'; + $this->sdkVersion = 'php/5.1.2'; // x-release-please-version $this->osPlatform = PHP_OS . " | " . phpversion(); } } From 0349b409e46b22bff6f708fcf15bdd61810146cf Mon Sep 17 00:00:00 2001 From: Subin Lee Date: Mon, 11 May 2026 09:43:48 +0900 Subject: [PATCH 2/2] =?UTF-8?q?ci:=20release-please=20release-type?= =?UTF-8?q?=EC=9D=84=20php=EB=A1=9C=20=EC=A0=84=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit release-please의 PHP strategy는 RootComposerUpdatePackages 업데이터로 composer.json의 version 필드를 자동 관리하고 jsonStringify 헬퍼로 원본 포맷을 보존한다. jsonpath updater를 별도로 두는 것보다 PHP 전용 처리가 더 안전하고 의도가 명확하다. - release-type: "simple" → "php" - extra-files에서 composer.json 항목 제거 (PHP strategy가 자동 처리) - DefaultAgent.php generic updater는 유지 Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/release-please-config.json | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/release-please-config.json b/.github/release-please-config.json index 51c035e..ddd592f 100644 --- a/.github/release-please-config.json +++ b/.github/release-please-config.json @@ -2,7 +2,7 @@ "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", "packages": { ".": { - "release-type": "simple", + "release-type": "php", "package-name": "solapi/sdk", "include-component-in-tag": false, "include-v-in-tag": true, @@ -11,11 +11,6 @@ "prerelease": false, "changelog-path": "CHANGELOG.md", "extra-files": [ - { - "type": "json", - "path": "composer.json", - "jsonpath": "$.version" - }, { "type": "generic", "path": "src/Models/Request/DefaultAgent.php"