From c28d85d52611fd83196cc876bc843f7eba234d3c Mon Sep 17 00:00:00 2001 From: Dave Friedel Date: Sun, 20 Jul 2025 15:24:05 -0400 Subject: [PATCH] Check Packagist --- .github/workflows/publish-package.yml | 35 +++++++++++++++++++++++++++ composer.json | 8 +++++- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish-package.yml diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml new file mode 100644 index 0000000..9b651ad --- /dev/null +++ b/.github/workflows/publish-package.yml @@ -0,0 +1,35 @@ +name: Publish Package + +on: + release: + types: [created] + +jobs: + publish-github: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.2 + + - name: Validate composer.json + run: composer validate + + - name: Configure GitHub Packages + run: | + composer config repositories.github '{"type": "vcs", "url": "https://github.com/sqrtspace/spacetime-php"}' + composer config --global --auth github-oauth.github.com ${{ secrets.GITHUB_TOKEN }} + + - name: Publish to GitHub Packages + run: | + sed -i 's/"name": "sqrtspace\/spacetime"/"name": "sqrtspace\/spacetime-php"/' composer.json + composer config repositories.github '{"type": "composer", "url": "https://nuget.pkg.github.com/sqrtspace/index.json"}' + echo "{\"github-oauth\": {\"github.com\": \"${{ secrets.GITHUB_TOKEN }}\"}}" > auth.json + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/composer.json b/composer.json index 00d20b3..1d70e94 100644 --- a/composer.json +++ b/composer.json @@ -85,5 +85,11 @@ } }, "minimum-stability": "stable", - "prefer-stable": true + "prefer-stable": true, + "repositories": [ + { + "type": "composer", + "url": "https://nuget.pkg.github.com/sqrtspace/index.json" + } + ] } \ No newline at end of file