-
Notifications
You must be signed in to change notification settings - Fork 1
78 lines (67 loc) 路 2.32 KB
/
Copy pathphar.yml
File metadata and controls
78 lines (67 loc) 路 2.32 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
name: PHAR
on:
push:
tags:
- '*'
pull_request:
branches:
- '**'
workflow_dispatch:
permissions:
contents: write
jobs:
phar:
runs-on: ubuntu-latest
name: Build PHAR
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: libxml, mbstring, simplexml, dom, intl
tools: composer, box
- name: Install Composer dependencies (production only)
run: composer install --no-dev --no-interaction --no-progress
- name: Compile PHAR
run: box compile --no-interaction
- name: Smoke test (valid files -> exit 0)
run: php composer-translation-validator.phar tests/src/Fixtures/translations/xliff/success
- name: Smoke test (invalid files -> exit 1)
run: |
set +e
php composer-translation-validator.phar tests/src/Fixtures/translations/xliff/fail
code=$?
set -e
if [ "$code" -ne 1 ]; then
echo "Expected exit code 1 for invalid fixtures, got $code" >&2
exit 1
fi
- name: Generate checksum
if: startsWith(github.ref, 'refs/tags/')
run: sha256sum composer-translation-validator.phar > composer-translation-validator.phar.sha256
- name: Attach PHAR to release
if: startsWith(github.ref, 'refs/tags/')
env:
GH_TOKEN: ${{ github.token }}
run: |
tag="${GITHUB_REF_NAME}"
# The release for this tag is created by the separate "Release" workflow,
# which may still be running. `gh release view`/`upload` correctly resolve
# drafts by tag name, unlike the REST /releases/tags/{tag} endpoint used by
# some third-party actions (which excludes drafts and would otherwise cause
# a duplicate, asset-less release to be created here).
for _ in $(seq 1 30); do
if gh release view "$tag" >/dev/null 2>&1; then
break
fi
sleep 5
done
gh release upload "$tag" \
composer-translation-validator.phar \
composer-translation-validator.phar.sha256 \
--clobber