kopia lustrzana https://github.com/browsh-org/browsh
Refactor to keep Browsh version in Go
rodzic
976c811884
commit
e270dca8aa
|
@ -0,0 +1,7 @@
|
|||
set -e
|
||||
|
||||
PROJECT_ROOT=$(git rev-parse --show-toplevel)
|
||||
version_file=$PROJECT_ROOT/interfacer/src/browsh/version.go
|
||||
line=$(cat $version_file | grep 'browshVersion')
|
||||
version=$(echo $line | grep -o '".*"' | sed 's/"//g')
|
||||
echo -n $version
|
|
@ -3,28 +3,26 @@
|
|||
set -e
|
||||
|
||||
PROJECT_ROOT=$(git rev-parse --show-toplevel)
|
||||
manifest=$PROJECT_ROOT/webext/manifest.json
|
||||
line=$(cat $manifest | grep '"version"')
|
||||
manifest_version=$(echo $line | grep -o '".*"' | cut -d " " -f 2 | sed 's/"//g')
|
||||
|
||||
browsh_version=$($PROJECT_ROOT/contrib/get_browsh_version.sh)
|
||||
latest_tagged_version=$(git tag --sort=v:refname --list 'v*.*.*' | tail -n1 | sed -e "s/^v//")
|
||||
|
||||
echo "manifest.json version: $manifest_version"
|
||||
echo "Browsh version: $browsh_version"
|
||||
echo "Latest tag: $latest_tagged_version"
|
||||
|
||||
if [[ "$manifest_version" == "$latest_tagged_version" ]]; then
|
||||
if [[ "$browsh_version" == "$latest_tagged_version" ]]; then
|
||||
echo "Not running release as there's no new version."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
git tag v$manifest_version
|
||||
git show v$manifest_version --quiet
|
||||
git tag v$browsh_version
|
||||
git show v$browsh_version --quiet
|
||||
git config --global user.email "builds@travis-ci.com"
|
||||
git config --global user.name "Travis CI"
|
||||
# `/dev/null` needed to prevent Github token appearing in logs
|
||||
git push --tags --quiet https://$GITHUB_TOKEN@github.com/browsh-org/browsh > /dev/null 2>&1
|
||||
|
||||
git reset --hard v$manifest_version
|
||||
git reset --hard v$browsh_version
|
||||
|
||||
cd $PROJECT_ROOT/webext
|
||||
BROWSH_ENV=RELEASE npm run build
|
||||
|
@ -35,8 +33,8 @@ curl -sL http://git.io/goreleaser | bash
|
|||
cd $HOME
|
||||
git clone https://github.com/browsh-org/www.brow.sh.git
|
||||
cd www.brow.sh
|
||||
echo "latest_version: $manifest_version" > _data/browsh.yml
|
||||
echo "latest_version: $browsh_version" > _data/browsh.yml
|
||||
git add _data/browsh.yml
|
||||
git commit -m "(Travis CI) Updated Browsh version to $manifest_version"
|
||||
git commit -m "(Travis CI) Updated Browsh version to $browsh_version"
|
||||
# `/dev/null` needed to prevent Github token appearing in logs
|
||||
git push --quiet https://$GITHUB_TOKEN@github.com/browsh-org/www.brow.sh > /dev/null 2>&1
|
||||
|
|
|
@ -10,15 +10,8 @@
|
|||
|
||||
set -e
|
||||
|
||||
if [ ! -f manifest.json ]; then
|
||||
PROJECT_ROOT=$(git rev-parse --show-toplevel)/webext
|
||||
else
|
||||
PROJECT_ROOT=.
|
||||
fi
|
||||
manifest=$PROJECT_ROOT/manifest.json
|
||||
|
||||
line=$(cat $manifest | grep '"version"')
|
||||
version=$(echo $line | grep -o '".*"' | cut -d " " -f 2 | sed 's/"//g')
|
||||
PROJECT_ROOT=$(git rev-parse --show-toplevel)
|
||||
version=$($PROJECT_ROOT/contrib/get_browsh_version.sh)
|
||||
|
||||
base='https://github.com/browsh-org/browsh/releases/download'
|
||||
release_url="$base/v$version/browsh_${version}_linux_amd64"
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
package browsh
|
||||
|
||||
var browshVersion = "1.4.1"
|
|
@ -16,10 +16,7 @@ cd $PROJECT_ROOT/webext && $NODE_BIN/webpack
|
|||
cd $PROJECT_ROOT/webext/dist && rm *.map
|
||||
$NODE_BIN/web-ext build --overwrite-dest
|
||||
|
||||
# Get the current version of Browsh
|
||||
version=$(cat $PROJECT_ROOT/webext/manifest.json | python2 -c \
|
||||
'import sys, json; print json.load(sys.stdin)["version"]'
|
||||
)
|
||||
version=$($PROJECT_ROOT/contrib/get_browsh_version.sh)
|
||||
|
||||
xpi_file=browsh-$version-an+fx.xpi
|
||||
zip_file=browsh-$version.zip
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"manifest_version": 2,
|
||||
"name": "Browsh",
|
||||
"version": "1.4.0",
|
||||
"version": "BROWSH_VERSION",
|
||||
|
||||
"description": "Renders the browser as realtime, interactive, TTY-compatible text",
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
const webpack = require('webpack');
|
||||
const path = require('path');
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||
const fs = require('fs');
|
||||
|
||||
module.exports = {
|
||||
mode: process.env['BROWSH_ENV'] === 'RELEASE' ? 'production' : 'development',
|
||||
|
@ -29,8 +30,17 @@ module.exports = {
|
|||
}),
|
||||
new CopyWebpackPlugin([
|
||||
{ from: 'assets', to: 'dist/assets' },
|
||||
{ from: 'manifest.json', to: 'dist/' },
|
||||
{ from: '.web-extension-id', to: 'dist/' },
|
||||
{ from: 'manifest.json', to: 'dist/',
|
||||
// Inject the current Browsh version into the manifest JSON
|
||||
transform(manifest, _) {
|
||||
const version_path = '../interfacer/src/browsh/version.go';
|
||||
let buffer = fs.readFileSync(version_path);
|
||||
let version_contents = buffer.toString();
|
||||
const matches = version_contents.match(/"(.*?)"/);
|
||||
return manifest.toString().replace('BROWSH_VERSION', matches[1]);
|
||||
}
|
||||
},
|
||||
])
|
||||
]
|
||||
};
|
||||
|
|
Ładowanie…
Reference in New Issue