mirror of
https://github.com/servo/servo.git
synced 2025-07-09 08:23:38 +01:00
47 lines
1.3 KiB
Bash
Executable file
47 lines
1.3 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
set -o errexit
|
|
set -o nounset
|
|
set -o pipefail
|
|
|
|
SCRIPTDIR=${PWD}/$(dirname ${0})
|
|
cd "${SCRIPTDIR}/../.."
|
|
|
|
PACKAGEPATH=$(ls -t target/brew/servo-????-??-??.tar.gz | head -n 1)
|
|
PACKAGENAME=$(basename ${PACKAGEPATH})
|
|
REGEX="s/servo-.*\([0-9]\{4\}\)-\([0-9]\{2\}\)-\([0-9]\{2\}\).tar.gz/\1.\2.\3/p"
|
|
VERSION=$(echo ${PACKAGENAME}| sed -n "${REGEX}")
|
|
SHA=$(shasum -a 256 ${PACKAGEPATH} | sed -e 's/ .*//')
|
|
GIT="https://${TOKEN}@github.com/servo/homebrew-servo.git"
|
|
|
|
# See upload_nightly.sh
|
|
PACKAGEURL="https://download.servo.org/nightly/macbrew/${PACKAGENAME}"
|
|
|
|
if [[ -z ${VERSION} ]]; then
|
|
echo "Package doesn't havent the right format: ${PACKAGENAME}"
|
|
exit 1
|
|
fi
|
|
|
|
TMP_DIR=$(mktemp -d -t homebrew-servo)
|
|
cd ${TMP_DIR}
|
|
echo ${TMP_DIR}
|
|
|
|
echo "Cloning"
|
|
git clone ${GIT}
|
|
cd homebrew-servo
|
|
|
|
# Not using "/" as it's used in PACKAGEURL
|
|
cat ${SCRIPTDIR}/servo-binary-formula.rb.in | sed \
|
|
"s|PACKAGEURL|${PACKAGEURL}|g
|
|
s|SHA|${SHA}|g
|
|
s|VERSION|${VERSION}|g" > Formula/servo-bin.rb
|
|
|
|
git add ./Formula/servo-bin.rb
|
|
git commit -m "Version bump: ${VERSION}"
|
|
|
|
git push -q ${GIT} master
|
|
rm -rf ${TMP_DIR}
|