Repository navigation
84 lines (70 loc) · 2.53 KB
/
Copy pathrelease.yml
File metadata and controls
84 lines (70 loc) · 2.53 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
81
82
83
84
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@v7
- 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@v7
- 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 --exclude-group benchmark
- 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@v7
- name: Create GitHub release
uses: softprops/action-gh-release@v3
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
# Credentials travel in the Authorization header (Packagist's recommended
# "Bearer USERNAME:API_TOKEN" scheme), never in the URL, so they cannot
# leak through request logs, proxies or curl error output.
curl -sf -XPOST -H 'Content-Type: application/json' \
-H "Authorization: Bearer ${PACKAGIST_USERNAME}:${PACKAGIST_TOKEN}" \
'https://packagist.org/api/update-package' \
-d '{"repository":"https://github.com/BabelQueue/php-sdk"}'
else
echo "Packagist secrets not set — relying on the Packagist GitHub webhook."
fi