-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (48 loc) · 1.65 KB
/
release.yml
File metadata and controls
57 lines (48 loc) · 1.65 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
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
release:
name: Publish
needs: validate
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