Skip to content

Commit 53e06d0

Browse files
committed
Travis deploy
1 parent faef20f commit 53e06d0

File tree

4 files changed

+84
-0
lines changed

4 files changed

+84
-0
lines changed

.travis.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
sudo: false
2+
language: php
3+
matrix:
4+
fast_finish: true
5+
include:
6+
- php: 7.1
7+
before_install:
8+
- openssl aes-256-cbc -K $encrypted_cbd724a3f1cf_key -iv $encrypted_cbd724a3f1cf_iv
9+
-in .travis/secrets.tar.enc -out .travis/secrets.tar -d
10+
- phpenv config-rm xdebug.ini
11+
- composer self-update
12+
install:
13+
- travis_retry composer install --no-interaction --no-dev --optimize-autoloader --classmap-authoritative
14+
- composer info -i
15+
16+
after_success:
17+
- if [[ $EXECUTE_DEPLOYMENT == 'true' && $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' ]]; then composer install --no-dev ; fi
18+
- if [[ $EXECUTE_DEPLOYMENT == 'true' && $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' ]]; then ./bin/deploy.sh ; fi

.travis/secrets.tar.enc

10 KB
Binary file not shown.

bin/deploy.sh

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
# Unpack secrets; -C ensures they unpack *in* the .travis directory
3+
tar xvf .travis/secrets.tar -C .travis
4+
5+
# Setup SSH agent:
6+
eval "$(ssh-agent -s)" #start the ssh agent
7+
chmod 600 .travis/build-key.pem
8+
ssh-add .travis/build-key.pem
9+
10+
# Setup git defaults:
11+
git config --global user.email "[email protected]"
12+
git config --global user.name "Florent Morselli"
13+
14+
# Add SSH-based remote to GitHub repo:
15+
git remote add deploy [email protected]:weierophinney/component-installer.git
16+
git fetch deploy
17+
18+
# Get box and build PHAR
19+
wget https://box-project.github.io/box2/manifest.json
20+
BOX_URL=$(php bin/parse-manifest.php manifest.json)
21+
rm manifest.json
22+
wget -O box.phar ${BOX_URL}
23+
chmod 755 box.phar
24+
./box.phar build -vv
25+
# Without the following step, we cannot checkout the gh-pages branch due to
26+
# file conflicts:
27+
mv component-installer.phar component-installer.phar.tmp
28+
29+
# Checkout gh-pages and add PHAR file and version:
30+
git checkout -b gh-pages deploy/gh-pages
31+
mv component-installer.phar.tmp component-installer.phar
32+
sha1sum component-installer.phar > component-installer.phar.version
33+
git add component-installer.phar component-installer.phar.version
34+
35+
# Commit and push:
36+
git commit -m 'Rebuilt phar'
37+
git push deploy gh-pages:gh-pages

bin/parse-manifest.php

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
chdir(__DIR__ . '/../');
3+
$fallbackUrl = 'https://github.com/box-project/box2/releases/download/2.7.5/box-2.7.5.phar';
4+
5+
if (! isset($argv[1]) || ! is_file($argv[1])) {
6+
return $fallbackUrl;
7+
}
8+
9+
$manifestJson = file_get_contents($argv[1]);
10+
$files = json_decode($manifestJson, true);
11+
12+
if (! is_array($files)) {
13+
echo $fallbackUrl;
14+
exit(0);
15+
}
16+
17+
foreach ($files as $file) {
18+
if (! is_array($file) || ! isset($file['version'])) {
19+
continue;
20+
}
21+
22+
if (version_compare($file['version'], '2.6.0', '>=')) {
23+
echo $file['url'];
24+
exit(0);
25+
}
26+
}
27+
28+
echo $fallbackUrl;
29+
exit(0);

0 commit comments

Comments
 (0)