mirror of
https://github.com/basecamp/trix.git
synced 2026-05-17 12:00:38 +00:00
e62fcc3b58
* Add GitHub Actions audit job (actionlint + zizmor) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Configure dependabot for github-actions, npm, and bundler with batching and cooldowns Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Add local GitHub Actions linting (actionlint + zizmor) to bin/setup and bin/ci Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Pin all GitHub Actions to SHA hashes Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Fix zizmor findings: add permissions and persist-credentials: false Set workflow-level permissions: {} and add per-job contents: read. Add persist-credentials: false to all checkout steps. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
80 lines
1.8 KiB
Bash
Executable File
80 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -eo pipefail
|
|
|
|
# Use binstubs. Work from the root dir.
|
|
app_root="$( cd "$(dirname "$0")/.."; pwd )"
|
|
|
|
# Prefer bin/ executables
|
|
export PATH="$app_root/bin:$PATH"
|
|
|
|
if [ "$1" = "-v" ]; then
|
|
exec 3>&1
|
|
else
|
|
exec 3>/dev/null
|
|
exec 4>&1
|
|
trap 'echo "Setup failed - run \`bin/setup -v\` to see the error output" >&4' ERR
|
|
fi
|
|
|
|
brew_install_missing() {
|
|
if which brew > /dev/null; then
|
|
if ! which "$1" > /dev/null; then
|
|
echo " -- Installing Homebrew package: $@"
|
|
brew reinstall "$@"
|
|
fi
|
|
else
|
|
return 1
|
|
fi
|
|
}
|
|
|
|
abort() {
|
|
echo "$@"
|
|
return 2
|
|
}
|
|
|
|
echo "--- Installing GitHub Actions linting tools"
|
|
{
|
|
for tool in actionlint shellcheck zizmor; do
|
|
if ! which "$tool" > /dev/null; then
|
|
brew_install_missing "$tool" || abort "Can't find or install $tool. Install it manually."
|
|
fi
|
|
done
|
|
} >&3 2>&1
|
|
|
|
echo "--- Installing Ruby gems"
|
|
{
|
|
if which rbenv > /dev/null; then
|
|
rbenv install --skip-existing
|
|
else
|
|
if ! which ruby > /dev/null; then
|
|
brew_install_missing ruby || abort "Can't find or install Ruby. Install it from https://www.ruby-lang.org or with https://github.com/rbenv/rbenv"
|
|
fi
|
|
fi
|
|
gem list -i bundler >/dev/null 2>&1 || gem install bundler
|
|
bundle check || bundle install
|
|
} >&3 2>&1
|
|
|
|
echo "--- Installing npm modules"
|
|
{
|
|
if ! which npm > /dev/null; then
|
|
brew_install_missing "npm" || abort "Can't find or install npm. Install it from https://nodejs.org"
|
|
fi
|
|
npm install
|
|
} >&3 2>&1
|
|
|
|
if [ -d "$HOME/.pow" ]; then
|
|
echo "--- Setting up Pow"
|
|
{ ln -nfs "$app_root" "$HOME/.pow/trix"
|
|
mkdir -p tmp
|
|
touch tmp/restart.txt
|
|
} >&3 2>&1
|
|
fi
|
|
|
|
echo
|
|
echo "Done!"
|
|
if [ -L "$HOME/.pow/trix" ]; then
|
|
echo " * Open http://trix.dev to develop in-browser"
|
|
else
|
|
echo " * Run \`bin/rackup\` to develop in-browser"
|
|
fi
|
|
echo " * Run \`bin/blade build\` to build Trix"
|