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..ddd592f --- /dev/null +++ b/.github/release-please-config.json @@ -0,0 +1,21 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "packages": { + ".": { + "release-type": "php", + "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": "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(); } }