-
-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (66 loc) · 2.25 KB
/
Copy pathrelease.yml
File metadata and controls
80 lines (66 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Release
on:
push:
tags: ['v*']
permissions:
contents: write
jobs:
validate:
name: Validate (tests green before publishing)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: json
coverage: none
tools: composer:v2
- name: Install dependencies
run: composer update --prefer-dist --no-interaction --no-progress
- name: Run tests
run: vendor/bin/phpunit
coverage:
name: Coverage gate (>=90%)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: json
coverage: pcov
tools: composer:v2
- name: Install dependencies
run: composer update --prefer-dist --no-interaction --no-progress
- name: Tests with coverage
run: vendor/bin/phpunit --coverage-clover=coverage.xml
- name: Enforce coverage gate
run: php bin/check-coverage.php coverage.xml 90
release:
name: Publish
needs: [validate, coverage]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
# Packagist normally auto-updates via its GitHub webhook. If you instead set
# PACKAGIST_USERNAME / PACKAGIST_TOKEN secrets, this pings its API.
# Release order matters: publish babelqueue/php-sdk BEFORE its adapters.
- name: Notify Packagist (optional)
env:
PACKAGIST_USERNAME: ${{ secrets.PACKAGIST_USERNAME }}
PACKAGIST_TOKEN: ${{ secrets.PACKAGIST_TOKEN }}
run: |
if [ -n "$PACKAGIST_TOKEN" ]; then
curl -sf -XPOST -H 'content-type:application/json' \
"https://packagist.org/api/update-package?username=${PACKAGIST_USERNAME}&apiToken=${PACKAGIST_TOKEN}" \
-d '{"repository":{"url":"https://github.com/BabelQueue/php-sdk"}}'
else
echo "Packagist secrets not set — relying on the Packagist GitHub webhook."
fi