-
Notifications
You must be signed in to change notification settings - Fork 1
86 lines (74 loc) · 1.83 KB
/
Copy pathrelease.yml
File metadata and controls
86 lines (74 loc) · 1.83 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
85
86
name: Release
on:
workflow_dispatch:
inputs:
type:
description: "Type of Release"
type: choice
default: minor
options:
- major
- minor
- hotfix
jobs:
validate:
name: Validate
runs-on: ubuntu-latest
steps:
- name: Ensure release runs from main
run: |
if [[ "$GITHUB_REF_NAME" != "main" ]]; then
echo "Releases may only be run against main."
exit 1
fi
pest:
name: Pest
runs-on: ubuntu-latest
needs: validate
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
coverage: none
- name: Install dependencies
uses: ramsey/composer-install@v3
- name: Run Pest
run: composer test
phpstan:
name: PHPStan
runs-on: ubuntu-latest
needs: validate
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
coverage: none
- name: Install dependencies
uses: ramsey/composer-install@v3
- name: Run PHPStan
run: composer phpstan
tag:
name: Tag
runs-on: ubuntu-latest
needs:
- pest
- phpstan
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create tag
run: |
git fetch --tags origin || true
LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1) 2>/dev/null || echo "v0.0.0")
echo "Previous tag $LATEST_TAG"
TAG=$(./bin/increment_version.sh "$LATEST_TAG" "${{ inputs.type }}")
echo "New tag $TAG"
git tag "$TAG"
git push origin "$TAG"