-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (48 loc) · 1.47 KB
/
release.yml
File metadata and controls
59 lines (48 loc) · 1.47 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
name: Build and Release PHAR
on:
push:
tags:
- '[0-9]*.[0-9]*.[0-9]*'
release:
types: [created]
pull_request:
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
ini-values: phar.readonly=0
- name: Get version from tag
id: version
run: echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Install dependencies
run: composer install --no-dev --prefer-dist --no-progress --optimize-autoloader
- name: Build PHAR
run: php -d phar.readonly=0 bin/build-phar.php agent-craft.phar
- name: Upload PHAR as artifact
uses: actions/upload-artifact@v4
with:
name: agent-craft
path: agent-craft.phar
- name: Upload PHAR to release
if: github.event_name == 'release'
uses: softprops/action-gh-release@v2
with:
files: agent-craft.phar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload PHAR to tag release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: agent-craft.phar
tag_name: ${{ steps.version.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}