-
Notifications
You must be signed in to change notification settings - Fork 20
69 lines (58 loc) · 2.03 KB
/
Copy pathrelease.yml
File metadata and controls
69 lines (58 loc) · 2.03 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
name: Release
on:
push:
tags: ['v*']
permissions: {}
jobs:
test:
runs-on: ubuntu-24.04
permissions:
contents: read
strategy:
fail-fast: false
matrix:
php-versions: ['8.0', '8.1', '8.4']
phpunit-versions: ['9.6']
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup PHP ${{ matrix.php-versions }}
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2.37.0
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit:${{ matrix.phpunit-versions }}
coverage: xdebug
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer update --no-interaction --no-progress --prefer-dist
- name: Run tests
run: phpunit --coverage-text
release:
needs: test
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Verify version matches tag
run: |
FILE_VERSION="v$(sed -n "s/.*apiVersion = '\([^']*\)'.*/\1/p" src/Http/Client.php)"
if [ "$FILE_VERSION" != "$GITHUB_REF_NAME" ]; then
echo "::error::Client.php version ($FILE_VERSION) does not match tag ($GITHUB_REF_NAME)"
exit 1
fi
- name: Create GitHub Release
run: gh release create "$GITHUB_REF_NAME" --generate-notes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}