-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from craftcms/feature/dev-83-provide-shell-one…
…-liner-for Shell one-liner
- Loading branch information
Showing
4 changed files
with
92 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Generate Release | ||
on: | ||
push: | ||
tags: | ||
- "*.*.*" | ||
|
||
jobs: | ||
generate_release: | ||
name: Generate release | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Archive release | ||
uses: thedoctor0/zip-release@master | ||
with: | ||
type: tar | ||
directory: ./server | ||
filename: ../craftcms-server-check.tar.gz | ||
exclusions: '*.git*' | ||
|
||
- name: Generate SHA256 | ||
run: sha256sum -b craftcms-server-check.tar.gz > sha256sum.txt | ||
|
||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
sha256sum.txt | ||
craftcms-server-check.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/bash | ||
|
||
# Craft CMS Server Check (one-liner) | ||
# | ||
# From the environment you want to check, run: | ||
# `curl -Lsf https://raw.githubusercontent.com/craftcms/server-check/HEAD/check.sh | bash` | ||
|
||
[[ $- = *i* ]] && echo "Don't source this script!" && return 10 | ||
|
||
checkTools() { | ||
Tools=("curl" "php" "rm" "tar" "grep" "cut") | ||
|
||
for tool in ${Tools[*]}; do | ||
if ! checkCmd $tool; then | ||
echo "Aborted, missing $tool." | ||
exit 6 | ||
fi | ||
done | ||
} | ||
|
||
checkCmd() { | ||
command -v "$1" > /dev/null 2>&1 | ||
} | ||
|
||
function serverCheck() { | ||
checkTools | ||
|
||
latestTag=$(curl -s https://api.github.com/repos/craftcms/server-check/releases | grep 'tag_name' | cut -d\" -f4) | ||
tmpDir="/tmp/craftcms-server-check-${latestTag}" | ||
assetUrl="https://github.com/craftcms/server-check/releases/download/${latestTag}/craftcms-server-check.tar.gz" | ||
downloadToFile="${tmpDir}/craftcms-server-check.tar.gz" | ||
phpScript="${tmpDir}/checkit.php" | ||
|
||
echo "Downloading file…" | ||
mkdir "$tmpDir" | ||
curl -fsSL "$assetUrl" --output "$downloadToFile" | ||
|
||
echo "Extracting…" | ||
tar -xzf "$downloadToFile" -C "$tmpDir" | ||
|
||
echo "Running Craft Server Check…" | ||
php $phpScript | ||
returnCode=$? | ||
|
||
rm -rf "$tmpDir" | ||
|
||
return $returnCode | ||
} | ||
|
||
serverCheck | ||
exit $? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
// Turn it all on. | ||
|