Skip to content

Commit ecd5db1

Browse files
tvdijenthijskh
andauthored
Clean repo & release-script (simplesamlphp#1717)
* Change build-script to leverage composer archive * No longer include data/ cache/ and log/ directories. They don't belong in the install-dir * Remove unnecessary .gitkeep files * Merge config&config-templates and metadata&metadata-templates; templates renamed to .dist * Reduce git clone overhead * Throw an exception if datadir not set Co-authored-by: Thijs Kinkhorst <thijs@kinkhorst.com>
1 parent 68a6b3e commit ecd5db1

19 files changed

Lines changed: 68 additions & 50 deletions

.gitattributes

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
/cache/.gitkeep export-ignore
2-
/config/.gitkeep export-ignore
3-
/metadata/.gitkeep export-ignore
1+
/cert/.gitkeep export-ignore
2+
/www/assets/css/.gitkeep export-ignore
3+
/www/assets/fonts/.gitkeep export-ignore
4+
/www/assets/js/.gitkeep export-ignore
45
/tests export-ignore
5-
/tools export-ignore
66
codecov.yml export-ignore
77
.editorconfig export-ignore
88
.gitattributes export-ignore

.gitignore

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
/log/
2-
/config/
3-
/metadata/
4-
/cert/
1+
cert/*
2+
config/*
3+
metadata/*
4+
!/cert/*.gitkeep
5+
!/config/*.dist
6+
!/metadata/*.dist
57
/www/assets/fonts/*
68
/www/assets/js/*.js
79
/www/assets/js/*.js.LICENSE.txt
@@ -13,10 +15,6 @@
1315
/www/assets/css/*.map
1416
.phpunit.result.cache
1517

16-
!/config/.gitkeep
17-
!/metadata/.gitkeep
18-
!/cache/.gitkeep
19-
!/locales/.gitkeep
2018
!/www/assets/fonts/.gitkeep
2119
!/www/assets/js/.gitkeep
2220
!/www/assets/css/.gitkeep

bin/build-release.sh

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ REPOPATH=$2
88
if ! shift; then
99
echo "$0: Missing required version parameter." >&2
1010
exit 1
11-
fi
12-
13-
if [ -z "$VERSION" ]; then
11+
elif [ -z "$VERSION" ]; then
1412
echo "$0: Empty version parameter." >&2
1513
exit 1
1614
fi
@@ -21,6 +19,7 @@ fi
2119

2220
TAG="v$VERSION"
2321
TARGET="simplesamlphp-$VERSION"
22+
COMPOSER="/tmp/composer.phar"
2423

2524
cd /tmp
2625

@@ -31,42 +30,24 @@ fi
3130

3231
umask 0022
3332

34-
git clone $REPOPATH $TARGET
33+
git clone --depth 1 --branch $TAG $REPOPATH $TARGET
3534
cd $TARGET
36-
git checkout $TAG
37-
cd ..
3835

39-
if [ ! -x "$TARGET/composer.phar" ]; then
40-
curl -sS https://getcomposer.org/installer | php -- --install-dir=$TARGET
36+
if [ ! -x "$COMPOSER" ]; then
37+
curl -sS https://getcomposer.org/installer | php -- --install-dir=/tmp
4138
fi
4239

4340
# Set the version in composer.json
44-
php "$TARGET/composer.phar" config version "v$VERSION" -d "$TARGET"
41+
php "$COMPOSER" config version "v$VERSION"
4542

4643
# Install dependencies (without vcs history or dev tools)
47-
php "$TARGET/composer.phar" install --no-dev --prefer-dist -o -d "$TARGET"
44+
php "$COMPOSER" install --no-dev --prefer-dist -o
4845

49-
cd $TARGET
5046
npm install
5147
npm audit fix
5248
npx browserslist@latest --update-db
5349
npm run build
54-
cd ..
55-
56-
mkdir -p "$TARGET/config" "$TARGET/metadata" "$TARGET/cert" "$TARGET/log" "$TARGET/data"
57-
cp -rv "$TARGET/config-templates/"* "$TARGET/config/"
58-
cp -rv "$TARGET/metadata-templates/"* "$TARGET/metadata/"
59-
rm -rf "$TARGET/.git"
60-
rm -rf "$TARGET/node_modules"
61-
rm "$TARGET/www/assets/js/stylesheet.js"*
62-
rm "$TARGET/.editorconfig"
63-
rm "$TARGET/.gitattributes"
64-
rm -r "$TARGET/.github"
65-
rm "$TARGET"/phpunit.xml
66-
rm "$TARGET"/{cache,config,metadata,locales}/.gitkeep
67-
rm "$TARGET/composer.phar"
68-
rm "$TARGET/bin/build-release.sh"
69-
tar --owner 0 --group 0 -cvzf "$TARGET.tar.gz" "$TARGET"
70-
rm -rf "$TARGET"
7150

51+
php "$COMPOSER" archive -f tar.gz --dir /tmp --file "$TARGET"
52+
rm "$COMPOSER"
7253
echo `shasum -a 256 /tmp/$TARGET.tar.gz`
File renamed without changes.

composer.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,5 +108,27 @@
108108
"simplesamlphp/composer-module-installer": true,
109109
"muglug/package-versions-56": true
110110
}
111+
},
112+
"archive": {
113+
"exclude": [
114+
".editorconfig",
115+
".gitattributes",
116+
".gitignore",
117+
".markdownlintignore",
118+
".markdownlintrc",
119+
".php_cs.dist",
120+
"bin/build-release.sh",
121+
"cert/.gitkeep",
122+
"codecov.yml",
123+
"node_modules",
124+
"phpcs.xml",
125+
"phpunit.xml",
126+
"phpunit-interoperability.xml",
127+
"psalm.xml",
128+
"tests",
129+
"www/assets/css/.gitkeep",
130+
"www/assets/fonts/.gitkeep",
131+
"www/assets/js/.gitkeep"
132+
]
111133
}
112134
}

config/.gitkeep

Whitespace-only changes.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@
6464
* When specified as a relative path, this is relative to the SimpleSAMLphp
6565
* root directory.
6666
*/
67-
'loggingdir' => 'log/',
68-
'datadir' => 'data/',
67+
//'loggingdir' => '/var/log/',
68+
//'datadir' => '/var/data/',
6969
'tempdir' => '/tmp/simplesaml',
7070

7171
/*

locales/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)