1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-12-22 13:45:02 +00:00

Add build action to sign releases

This commit is contained in:
Starbeamrainbowlabs 2020-07-10 20:16:17 +01:00
parent 41db6fb786
commit 4c54ae22d8
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
2 changed files with 31 additions and 0 deletions

View file

@ -43,6 +43,7 @@ if [[ "$#" -lt 1 ]]; then
echo -e " ${CACTION}docs-livereload${RS} - Start the documentation livereload server";
echo -e " ${CACTION}start-server${RS} - Start a development server";
echo -e " ${CACTION}stop-server${RS} - Stop the development server";
echo -e " ${CACTION}sign${RS} - Sign the current build with SHA256 & GPG";
echo -e " ${CACTION}clean${RS} - Delete all build outputs (WARNING: THIS WILL DELETE ALL WIKI DATA)";
echo -e "";
@ -296,6 +297,33 @@ task_stop-server() {
task_end "$?";
}
task_sign() {
task_begin "Preparing to sign release";
if [[ ! -f "build/index.php" ]]; then
task_end 1 "Error: build/index.php doesn't exist";
fi
temp_dir="$(mktemp --tmpdir -d "pepperminty-wiki-XXXXXXX")";
cp "build/index.php" "${temp_dir}";
task_end "$?";
task_begin "Signing release";
pushd "${temp_dir}" || { echo "Error: Failed to cd to temporary directory"; exit 1; };
# Generate hashes
find . -type f -not -name "*.SHA256" -print0 | xargs -0 -n1 -I{} -P"$(nproc)" sha256sum -b "{}" >HASHES.SHA256;
# Generate GPG signature
gpg --sign --detach-sign --armor HASHES.SHA256;
popd || { echo ""; exit 1; };
task_end "$?";
task_begin "Finalising";
cp "${temp_dir}/HASHES.SHA256" "./build";
cp "${temp_dir}/HASHES.SHA256.asc" "./build";
echo -e "Written output files to ${HC}$(display_url "${PWD}/build/HASHES.SHA256" "HASHES.SHA256") ${RS}and ${HC}$(display_url "${PWD}/build/HASHES.SHA256.asc" "HASHES.SHA256.asc").${RS}";
rm -r "${temp_dir}";
task_end "$?" "Failed to finalise!";
}
task_clean() {
task_begin "Clearing out build outputs";

View file

@ -17,6 +17,7 @@ The following things need to be done to prepare for a release:
- Pull down changes to update [online downloader](https://starbeamrainbowlabs.com/labs/peppermint/download.php)
- Ensure docs are up-to-date
- Update wikimatrix
- Generate the hashes & signature (see the `sign` build action)
- Write & publish the release
## Release text template
@ -30,6 +31,8 @@ Note that this is a maintenance release that backports some urgent bugfixes to L
Have you updated to this release? [Click this link to say hi](https://starbeamrainbowlabs.com/blog/viewtracker.php?action=record&format=text&post-id=pepperminty-wiki/PEPPERMINTY_WIKI_VERSION)!
This release also has an experimental GPG and SHA256 hashes file attached. My GPG key is `AEBDEBC37E56742E9DFF782A1BE5172E637709C2` - please [open an issue](https://github.com/sbrl/Pepperminty-Wiki/issues/) if you encounter any issues :slightly_smiling_face:
## Updating
You can update to this release simply by grabbing an updated copy of `index.php` and replacing the version in your current wiki (don't forget to take backups! I make every effort to squash as many bugs as possible, but you can never be too certain). You can get an updated copy of `index.php` in a number of ways: