Skip to content
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
15 changes: 0 additions & 15 deletions .editorconfig

This file was deleted.

24 changes: 15 additions & 9 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
*.php diff=php

# Ignore all test and documentation with "export-ignore".
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
/scrutinizer.yml export-ignore
/tests export-ignore
/.github export-ignore
/bin export-ignore
/scripts export-ignore
/tests export-ignore

/.gitattributes export-ignore
/.gitignore export-ignore
/.php-cs-fixer.dist.php export-ignore
/.phpactor.json export-ignore
/.release-please-manifest.json export-ignore
/.stats.yml export-ignore
/phpstan.dist.neon export-ignore
/phpunit.xml.dist export-ignore
/release-please-config.json export-ignore
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CI
on:
push:
branches:
- '**'
- '!integrated/**'
- '!stl-preview-head/**'
- '!stl-preview-base/**'
- '!generated'
- '!codegen/**'
- 'codegen/stl/**'
pull_request:
branches-ignore:
- 'stl-preview-head/**'
- 'stl-preview-base/**'

jobs:
lint:
timeout-minutes: 10
name: lint
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Set up PHP
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # 2.37.0
with:
php-version: '8.3'

- name: Run Bootstrap
run: ./scripts/bootstrap

- name: Run lints
run: ./scripts/lint
29 changes: 0 additions & 29 deletions .github/workflows/coverage.yml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/publish-packagist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Publish Packagist
on:
workflow_dispatch:

release:
types: [published]

jobs:
publish:
name: publish
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Publish to Packagist
run: |-
curl --fail-with-body -X POST -H 'Content-Type: application/json' "https://packagist.org/api/update-package?username=${PACKAGIST_USERNAME}&apiToken=${PACKAGIST_SAFE_KEY}" -d '{"repository":"https://github.com/imagekit-developer/imagekit-php"}'
env:
PACKAGIST_USERNAME: ${{ secrets.IMAGE_KIT_PACKAGIST_USERNAME || secrets.PACKAGIST_USERNAME }}
PACKAGIST_SAFE_KEY: ${{ secrets.IMAGE_KIT_PACKAGIST_SAFE_KEY || secrets.PACKAGIST_SAFE_KEY }}
23 changes: 23 additions & 0 deletions .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Release Doctor
on:
pull_request:
branches:
- master
workflow_dispatch:

jobs:
release_doctor:
name: release doctor
runs-on: ubuntu-latest
if: github.repository == 'imagekit-developer/imagekit-php' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Check release environment
run: |
bash ./bin/check-release-environment
env:
RELEASE_PLEASE_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }}
PACKAGIST_USERNAME: ${{ secrets.IMAGE_KIT_PACKAGIST_USERNAME || secrets.PACKAGIST_USERNAME }}
PACKAGIST_SAFE_KEY: ${{ secrets.IMAGE_KIT_PACKAGIST_SAFE_KEY || secrets.PACKAGIST_SAFE_KEY }}
20 changes: 20 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Release Please
on:
push:
branches:
- master

permissions:
contents: write
pull-requests: write

jobs:
release-please:
if: github.repository == 'imagekit-developer/imagekit-php'
runs-on: ubuntu-latest

steps:
- uses: googleapis/release-please-action@5c625bfb5d1ff62eadeeb3772007f7f66fdcf071 # v4.4.1
id: release
with:
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
65 changes: 65 additions & 0 deletions .github/workflows/stlc-promote.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Promote SDKs

on:
push:
branches: [main]

permissions:
contents: read

jobs:
promote:
runs-on: ubuntu-latest
env:
PRODUCTION_REPO: imagekit-developer/imagekit-php
PRODUCTION_BRANCH: master
GH_TOKEN: ${{ secrets.SDK_WRITE_TOKEN }}
steps:
- name: Check out staging
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Fetch production main
run: |
git remote add production \
"https://x-access-token:${GH_TOKEN}@github.com/${PRODUCTION_REPO}.git"
git fetch production "${PRODUCTION_BRANCH}"

- name: Check if production is already in sync
id: diff
run: |
STAGING_SHA=$(git rev-parse origin/main)
PRODUCTION_SHA=$(git rev-parse production/${PRODUCTION_BRANCH})
if [ "$STAGING_SHA" = "$PRODUCTION_SHA" ]; then
echo "Production is already at $STAGING_SHA. Nothing to release."
echo "synced=true" >> "$GITHUB_OUTPUT"
else
echo "synced=false" >> "$GITHUB_OUTPUT"
fi

- name: Push staging main to the release branch on production
if: steps.diff.outputs.synced == 'false'
run: |
git push production origin/main:refs/heads/stainless/release --force

- name: Open or update the release PR on production
if: steps.diff.outputs.synced == 'false'
run: |
EXISTING_PR=$(gh pr list \
--repo "${PRODUCTION_REPO}" \
--head stainless/release \
--state open \
--json number \
--jq '.[0].number')
if [ -z "${EXISTING_PR}" ]; then
gh pr create \
--repo "${PRODUCTION_REPO}" \
--base "${PRODUCTION_BRANCH}" \
--head stainless/release \
--title "Release SDK updates" \
--body "$(git log --oneline production/${PRODUCTION_BRANCH}..origin/main)"
else
echo "Release PR #${EXISTING_PR} already exists. Force-push has updated it."
fi
63 changes: 63 additions & 0 deletions .github/workflows/sync-release-as.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Sync Release-As from release PR title

on:
pull_request:
types: [edited]

permissions:
contents: write

jobs:
sync:
if: >-
github.event.pull_request.base.ref == 'master' &&
startsWith(github.event.pull_request.head.ref, 'release-please--') &&
github.event.changes.title != null
runs-on: ubuntu-latest
steps:
- name: Extract versions from old and new title
id: parse
env:
NEW_TITLE: ${{ github.event.pull_request.title }}
OLD_TITLE: ${{ github.event.changes.title.from }}
run: |
# Anchored on pull-request-title-pattern "release: ${version}" from release-please-config.json.
extract() {
echo "$1" | grep -oE '^release:[[:space:]]+v?[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?' \
| sed -E 's/^release:[[:space:]]+v?//'
}
NEW_VERSION=$(extract "$NEW_TITLE")
OLD_VERSION=$(extract "$OLD_TITLE")
echo "old=$OLD_VERSION"
echo "new=$NEW_VERSION"
if [ -z "$NEW_VERSION" ]; then
echo "::notice::No semver in new title; nothing to do."
echo "skip=true" >> "$GITHUB_OUTPUT"
exit 0
fi
if [ "$NEW_VERSION" = "$OLD_VERSION" ]; then
echo "::notice::Version unchanged ($NEW_VERSION); not pushing."
echo "skip=true" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "version=$NEW_VERSION" >> "$GITHUB_OUTPUT"

- name: Check out master
if: steps.parse.outputs.skip != 'true'
uses: actions/checkout@v6
with:
ref: master
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
fetch-depth: 1

- name: Push empty Release-As commit
if: steps.parse.outputs.skip != 'true'
env:
VERSION: ${{ steps.parse.outputs.version }}
run: |
git config user.name "release-as-bot"
git config user.email "release-as-bot@users.noreply.github.com"
git commit --allow-empty -m "chore: pin next release

Release-As: ${VERSION}"
git push origin master
31 changes: 0 additions & 31 deletions .github/workflows/test.yml

This file was deleted.

24 changes: 0 additions & 24 deletions .github/workflows/wiki.yml

This file was deleted.

Loading