Skip to content

Commit 2a95d3d

Browse files
oschwaldclaude
andcommitted
Manage box, composer, and phpDocumentor via mise
The release script previously downloaded box.phar 4.6.10 and phpDocumentor.phar 3.8.1 with wget, verifying hardcoded sha256 hashes, and used a local composer.phar kept current via self-update. Install all three via mise's github backend instead, upgrading to box 4.7.0 and phpDocumentor 3.10.0. Integrity pinning moves to mise.lock, which records per-platform checksums, and mise additionally verifies SLSA provenance or GitHub artifact attestations at install time. Box 4.7.0 and phpDocumentor 3.10.0 were verified against this project: box compiles a working geoip2.phar (phar-test passes) and phpDocumentor generates the API docs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 0d5ec79 commit 2a95d3d

4 files changed

Lines changed: 137 additions & 26 deletions

File tree

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@ docs/public/
88
.phpunit.cache/
99
.phpunit.result.cache
1010
GeoLite2-City.mmdb
11-
box.phar
1211
build
1312
composer.lock
14-
composer.phar
15-
/phpDocumentor.phar
1613
phpunit.xml
1714
geoip2.phar
1815
geoip2-php.sublime-*

dev-bin/release.sh

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ fi
3232

3333
check_command perl
3434
check_command php
35-
check_command wget
35+
36+
# box.phar, composer.phar, and phpDocumentor.phar are managed by mise (see
37+
# mise.toml)
38+
check_command box.phar
39+
check_command composer.phar
40+
check_command phpDocumentor.phar
3641

3742
# Check that we're not on the main branch
3843
current_branch=$(git branch --show-current)
@@ -89,21 +94,12 @@ fi
8994

9095
rm -fr vendor
9196

92-
php composer.phar self-update
93-
php composer.phar update --no-dev
97+
composer.phar update --no-dev
9498

9599
perl -pi -e "s/(?<=const VERSION = ').+?(?=';)/$tag/g" src/WebService/Client.php
96100
perl -pi -e "s{(?<=php composer\.phar require geoip2/geoip2:).+}{^$version}g" README.md
97101

98-
box_phar_hash='f98cf885a7c07c84df66e33888f1d93f063298598e0a5f41ca322aeb9683179b box.phar'
99-
100-
if ! echo "$box_phar_hash" | sha256sum -c; then
101-
wget -O box.phar "https://github.com/box-project/box/releases/download/4.6.10/box.phar"
102-
fi
103-
104-
echo "$box_phar_hash" | sha256sum -c
105-
106-
php box.phar compile
102+
box.phar compile
107103

108104
phar_test=$(./dev-bin/phar-test.php)
109105
if [[ -n $phar_test ]]; then
@@ -112,7 +108,7 @@ if [[ -n $phar_test ]]; then
112108
fi
113109

114110
# Download test deps
115-
php composer.phar update
111+
composer.phar update
116112

117113
./vendor/bin/phpunit
118114

@@ -141,20 +137,11 @@ if [ -n "$(git status --porcelain)" ]; then
141137
exit 1
142138
fi
143139

144-
# Using Composer is possible, but they don't recommend it.
145-
phpdocumentor_phar_hash='aa00973d88b278fe59fd8dce826d8d5419df589cb7563ac379856ec305d6b938 phpDocumentor.phar'
146-
147-
if ! echo "$phpdocumentor_phar_hash" | sha256sum -c; then
148-
wget -O phpDocumentor.phar https://github.com/phpDocumentor/phpDocumentor/releases/download/v3.8.1/phpDocumentor.phar
149-
fi
150-
151-
echo "$phpdocumentor_phar_hash" | sha256sum -c
152-
153140
# Use cache dir in /tmp as otherwise cache files get into the output directory.
154141
cachedir="/tmp/phpdoc-$$-$RANDOM"
155142
rm -rf "$cachedir"
156143

157-
php phpDocumentor.phar \
144+
phpDocumentor.phar \
158145
--visibility=public \
159146
--cache-folder="$cachedir" \
160147
--title="GeoIP PHP API $tag" \

mise.lock

Lines changed: 124 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mise.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ disable_backends = [
66
]
77

88
[tools]
9+
"github:box-project/box" = "latest"
10+
"github:composer/composer" = "latest"
11+
"github:phpDocumentor/phpDocumentor" = "latest"
912
hugo = "latest"
1013
lychee = "latest"
1114

0 commit comments

Comments
 (0)