diff --git a/.github/workflows/lint-pr-title.yml b/.github/workflows/lint-pr-title.yml new file mode 100644 index 0000000..764d4e6 --- /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_title: + runs-on: ubuntu-latest + steps: + - 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 new file mode 100644 index 0000000..f727f27 --- /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@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1 + with: + app-id: ${{ vars.SDK_BOT_APP_ID }} + private-key: ${{ secrets.SDK_BOT_PRIVATE_KEY }} + + - uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4.4.0 + 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/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 new file mode 100644 index 0000000..1449c3f --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "packages": { + ".": { + "release-type": "php", + "package-name": "workos/workos-php", + "changelog-path": "CHANGELOG.md", + "extra-files": [ + { + "type": "generic", + "path": "lib/Version.php" + } + ] + } + } +}