-
Notifications
You must be signed in to change notification settings - Fork 19
133 lines (119 loc) · 5.24 KB
/
release.yml
File metadata and controls
133 lines (119 loc) · 5.24 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
---
name: Release
on:
workflow_dispatch:
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onworkflow_dispatchinputs
inputs:
operating-system:
description: "OS name and version runtime"
required: false
default: "ubuntu-22.04"
type: string
php-version:
description: "PHP runtime version in format Major.minor"
required: false
default: "8.2"
type: string
composer-options:
description: "Composer options for ramsey/composer-install GitHub Action"
required: false
default: "--prefer-dist --no-scripts"
type: string
box-output:
description: "Path to the PHP Archive made by the BOX"
required: true
default: "bin/phpcompatinfo.phar"
type: string
box-manifest-version:
# https://github.com/llaville/box-manifest
description: "BOX Manifest runtime version in semver format"
required: false
default: "4.2.0"
type: string
box-manifest-options:
description: "Additional options to pass to BOX Manifest (e.g. `--bootstrap bootstrap.php -r plain.txt -r sbom.json`)"
required: false
default: "-r console-table.txt -r plain.txt -r sbom.json"
type: string
tag-name:
description: "New Release Tag"
required: false
default: ""
type: string
permissions:
contents: write
jobs:
lint_files:
uses: ./.github/workflows/mega-linter.yml
with:
operating-system: ${{ inputs.operating-system }}
php-version: ${{ inputs.php-version }}
composer-options: ${{ inputs.composer-options }}
unit_tests:
uses: ./.github/workflows/unit-tests.yml
with:
operating-system: ${{ inputs.operating-system }}
composer-options: ${{ inputs.composer-options }}
create_release:
if: inputs.tag-name != ''
needs:
- lint_files
- unit_tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ${{ inputs.operating-system }}
php:
- ${{ inputs.php-version }}
tools:
- box:4.6 # available since https://github.com/shivammathur/setup-php/releases/tag/2.27.0
steps:
- # https://github.com/actions/checkout
name: Checkout
uses: actions/checkout@v4.3.0
with:
# Make sure the value of GITHUB_TOKEN will not be persisted in repo's config
persist-credentials: false
- # https://github.com/shivammathur/setup-php
name: Setup PHP runtime
uses: shivammathur/setup-php@2.35.5
with:
php-version: ${{ matrix.php }}
coverage: "none"
tools: ${{ matrix.tools }}
- # https://getcomposer.org/doc/06-config.md#platform
name: Setup Composer Platform
run: |
composer config platform.php 8.1
- # https://github.com/ramsey/composer-install
name: Install Composer dependencies
uses: ramsey/composer-install@3.1.1
with:
dependency-versions: "highest"
composer-options: ${{ inputs.composer-options }}
- # https://github.com/llaville/box-manifest
name: Download BOX Manifest Artifact
env:
BOX_MANIFEST_VERSION: ${{ inputs.box-manifest-version }}
run: |
curl -Ls "https://github.com/llaville/box-manifest/releases/download/$BOX_MANIFEST_VERSION/box-manifest.phar" -o /usr/local/bin/box-manifest
chmod +x /usr/local/bin/box-manifest
- # https://github.com/llaville/box-manifest
name: Build Release Artifact
run: |
box-manifest make build stub configure ${{ inputs.box-manifest-options }} --output-stub stub.php --output-conf box.json.dist -vvv --ansi
box compile -c box.json.dist -vvv --ansi
- # https://github.com/softprops/action-gh-release
name: Create Release from current tag
uses: softprops/action-gh-release@v2.4.0
with:
# https://github.com/softprops/action-gh-release#-customizing
prerelease: false
draft: false
body_path: ${{ github.workspace }}/.changes/7.x/${{ inputs.tag-name }}.md
# https://github.com/softprops/action-gh-release#%EF%B8%8F-uploading-release-assets
files: ${{ github.workspace }}/${{ inputs.box-output }}
fail_on_unmatched_files: true
tag_name: ${{ inputs.tag-name }}