Skip to content

Commit cc123e0

Browse files
Standardize GitHub workflows: update actions, fix PHP version, clean up changelog
1 parent c07e2c8 commit cc123e0

4 files changed

Lines changed: 19 additions & 47 deletions

File tree

.github/workflows/build.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,26 @@ jobs:
1414
- name: Checkout code
1515
uses: actions/checkout@v6
1616
with:
17-
ref: ${{ github.head_ref }}
17+
fetch-depth: 0
1818

19-
- name: 'Get Previous tag'
20-
id: previoustag
21-
uses: "WyriHaximus/github-action-get-previous-tag@v2"
22-
with:
23-
fallback: unreleased
19+
- name: Get latest tag
20+
id: version
21+
run: echo "tag=$(git describe --tags --abbrev=0 2>/dev/null || echo unreleased)" >> "$GITHUB_OUTPUT"
2422

2523
- name: Setup PHP
2624
uses: shivammathur/setup-php@v2
2725
with:
28-
php-version: 8.2
26+
php-version: 8.4
2927
extensions: dom, curl, libxml, mbstring, zip
30-
ini-values: error_reporting=E_ALL
28+
ini-values: error_reporting=E_ALL, phar.readonly=Off
3129
tools: composer:v2
3230
coverage: none
3331

3432
- name: Install the dependencies
3533
run: composer install --prefer-dist --optimize-autoloader --no-interaction --no-progress --no-suggest --no-scripts --ansi -v --ignore-platform-req=ext-pcntl --ignore-platform-req=ext-posix --ignore-platform-req=ext-sockets
3634

3735
- name: Execute build
38-
run: php filakit app:build filakit --build-version=${{ steps.previoustag.outputs.tag }}
36+
run: php filakit app:build filakit --build-version=${{ steps.version.outputs.tag }}
3937

4038
- name: Commit changes
4139
uses: stefanzweifel/git-auto-commit-action@v7

.github/workflows/phpstan.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
paths:
66
- '**.php'
77
- 'phpstan.neon.dist'
8+
workflow_dispatch:
89

910
jobs:
1011
phpstan:
@@ -16,7 +17,7 @@ jobs:
1617
- name: Setup PHP
1718
uses: shivammathur/setup-php@v2
1819
with:
19-
php-version: '8.2'
20+
php-version: '8.4'
2021
coverage: none
2122

2223
- name: Install composer dependencies

.github/workflows/publish-phar.yml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,28 @@ jobs:
1414
name: Release PHAR
1515

1616
steps:
17-
- name: Extract the tag version
18-
id: tag
19-
run: |
20-
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
21-
GITHUB_REF=${{ github.event.inputs.tag }}
22-
fi
23-
echo "tag=${GITHUB_REF##*v}" >> "$GITHUB_OUTPUT"
24-
2517
- name: Checkout the code
2618
uses: actions/checkout@v6
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Get release version
23+
id: tag
24+
run: echo "tag=$(git describe --tags --abbrev=0 2>/dev/null || echo unreleased)" >> "$GITHUB_OUTPUT"
2725

2826
- name: Setup PHP
2927
uses: shivammathur/setup-php@v2
3028
with:
31-
php-version: 8.2
29+
php-version: 8.4
3230
extensions: dom, curl, libxml, mbstring, zip
33-
ini-values: error_reporting=E_ALL
31+
ini-values: error_reporting=E_ALL, phar.readonly=Off
3432
tools: composer:v2
3533
coverage: none
3634

3735
- name: Install the dependencies
3836
run: composer install --prefer-dist --optimize-autoloader --no-interaction --no-progress --no-suggest --no-scripts --ansi -v --ignore-platform-req=ext-pcntl --ignore-platform-req=ext-posix --ignore-platform-req=ext-sockets
3937

40-
- name: Update the dependencies # windows does not support ext-pcntl、ext-posix、ext-sockets
38+
- name: Update the dependencies
4139
run: composer update --prefer-dist --optimize-autoloader --no-interaction --no-progress --no-suggest --no-scripts --ansi -v --ignore-platform-req=ext-pcntl --ignore-platform-req=ext-posix --ignore-platform-req=ext-sockets
4240

4341
- name: Create the PHAR file.

.github/workflows/update-changelog.yml

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -40,33 +40,8 @@ jobs:
4040
latest-version: ${{ github.event.release.tag_name }}
4141
compare-url-target-revision: ${{ github.event.release.target_commitish }}
4242

43-
# Optional
44-
# If your project keeps separate branches for major releases, and you want to point the compare URL
45-
# in the "Unreleased"-heading to the corresponding major release branch (eg. `2.x`), then enable the option
46-
# below.
47-
# `compare-url-target-revision` will change how the compare URL is composed and will replace
48-
# `v2.0.1...HEAD` with `v2.0.1...2.x`.
49-
# WARNING: When you select `main` when creating a new release, the value `refs/heads/main`
50-
# is passed to the Action which will generate an invalid compare URL.
51-
# compare-url-target-revision: ${{ github.event.release.target_commitish }}
52-
53-
- name: "release_compare_url"
54-
# https://github.com/org/repo/compare/v1.0.0...v1.1.0
55-
run: "echo ${{ steps.changelog-updater.outputs.release_compare_url }}"
56-
57-
- name: "release_url_fragment"
58-
# #v100---2021-02-01
59-
run: "echo ${{ steps.changelog-updater.outputs.release_url_fragment }}"
60-
61-
- name: "unreleased_compare_url"
62-
# https://github.com/org/repo/compare/v1.0.0...HEAD
63-
run: "echo ${{ steps.changelog-updater.outputs.unreleased_compare_url }}"
64-
6543
- name: Write Version to File
66-
uses: brettdorrans/write-version-to-file@v1.1.0
67-
with:
68-
filename: 'version.txt'
69-
placeholder: '${VERSION}'
44+
run: echo "${{ github.event.release.tag_name }}" > version.txt
7045

7146
- name: Commit updated CHANGELOG
7247
uses: stefanzweifel/git-auto-commit-action@v7

0 commit comments

Comments
 (0)