@@ -12,22 +12,20 @@ jobs: | |||
- uses: actions/checkout@v1 | |||
- name: deploy containers | |||
run: | | |||
cd containers | |||
./deploy | |||
./bin/deploy_containers | |||
env: | |||
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }} | |||
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }} | |||
deploy-packages: | |||
deploy-node-modules: | |||
runs-on: ubuntu-latest | |||
steps: | |||
- uses: actions/checkout@v1 | |||
- name: deploy packages | |||
- name: deploy node modules | |||
run: | | |||
cd packages | |||
./deploy | |||
./bin/deploy_node_modules | |||
env: | |||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |||
deploy-cli: | |||
runs-on: ubuntu-latest | |||
@@ -38,12 +36,23 @@ jobs: | |||
with: | |||
python-version: '3.x' | |||
- name: deploy cli | |||
run: | | |||
./bin/deploy_cli | |||
env: | |||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |||
deploy-web-extensions: | |||
runs-on: ubuntu-latest | |||
steps: | |||
- uses: actions/checkout@v1 | |||
- name: deploy web extensions | |||
run: | | |||
cd cli | |||
python -m pip install --upgrade pip | |||
pip install setuptools wheel twine | |||
python setup.py sdist bdist_wheel | |||
twine upload dist/* | |||
./bin/deploy_web_extensions | |||
env: | |||
EXTENSION_ID: ${{ secrets.EXTENSION_ID }} | |||
CLIENT_ID: ${{ secrets.CLIENT_ID }} | |||
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} | |||
REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} | |||
WEB_EXT_API_KEY: ${{ secrets.WEB_EXT_API_KEY }} | |||
WEB_EXT_API_SECRET: ${{ secrets.WEB_EXT_API_SECRET }} |
@@ -1,11 +0,0 @@ | |||
#!/usr/bin/env bash | |||
set -o errexit | |||
set -o pipefail | |||
set -o nounset | |||
yarn install | |||
yarn workspace lesspass-pure run build | |||
rm -rf packages/lesspass-web-extension/extension/dist | |||
mkdir packages/lesspass-web-extension/extension/dist | |||
cp -r packages/lesspass-pure/dist/. packages/lesspass-web-extension/extension/dist/ |
@@ -0,0 +1,27 @@ | |||
#!/usr/bin/env bash | |||
function check_env_variables_are_setted { | |||
if [ -z "${TWINE_USERNAME}" ] || [ -z "${TWINE_PASSWORD}" ]; then | |||
echo "Need to set TWINE_USERNAME and TWINE_PASSWORD env variables to release cli" | |||
exit 1 | |||
fi | |||
} | |||
set +o errexit | |||
check_env_variables_are_setted | |||
set -o errexit | |||
set -o pipefail | |||
set -o nounset | |||
function push_cli_on_pypi { | |||
pushd cli | |||
python -m pip install --upgrade pip | |||
pip install setuptools wheel twine | |||
python setup.py sdist bdist_wheel | |||
twine upload dist/* | |||
popd | |||
} | |||
push_cli_on_pypi |
@@ -0,0 +1,34 @@ | |||
#!/usr/bin/env bash | |||
function check_env_variables_are_setted { | |||
if [ -z "${QUAY_USERNAME}" ] || [ -z "${QUAY_PASSWORD}" ]; then | |||
echo "Need to set QUAY_USERNAME and QUAY_PASSWORD env variables to release containers" | |||
exit 1 | |||
fi | |||
} | |||
set +o errexit | |||
check_env_variables_are_setted | |||
set -o errexit | |||
set -o pipefail | |||
set -o nounset | |||
function build_and_push_container { | |||
pushd containers | |||
container=$1 | |||
docker build --tag lesspass/${container} ./${container} | |||
docker tag lesspass/${container} quay.io/lesspass/${container} | |||
docker push quay.io/lesspass/${container} | |||
popd | |||
} | |||
function build_and_push_containers { | |||
docker login --username="${QUAY_USERNAME}" --password="${QUAY_PASSWORD}" quay.io | |||
build_and_push_container webserver | |||
build_and_push_container backend | |||
build_and_push_container frontend | |||
} | |||
build_and_push_containers |
@@ -0,0 +1,33 @@ | |||
#!/usr/bin/env bash | |||
function check_env_variables_are_setted { | |||
if [ -z "${NPM_TOKEN}" ]; then | |||
echo "Need to set NPM_TOKEN env variable to release node modules" | |||
exit 1 | |||
fi | |||
} | |||
set +o errexit | |||
check_env_variables_are_setted | |||
set -o errexit | |||
set -o pipefail | |||
set -o nounset | |||
function push_packages_on_npm { | |||
grep --fixed-strings --line-regexp --silent "//registry.npmjs.org/:_authToken=$NPM_TOKEN" ~/.npmrc | |||
if [ $? == 1 ] | |||
then | |||
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc | |||
fi | |||
projects="lesspass lesspass-crypto lesspass-entropy lesspass-fingerprint lesspass-pure lesspass-render-password" | |||
for project in ${projects} | |||
do | |||
pushd packages/${project} | |||
yarn publish --new-version | |||
popd | |||
done | |||
} | |||
push_packages_on_npm |
@@ -0,0 +1,25 @@ | |||
#!/usr/bin/env bash | |||
function check_env_variables_are_setted { | |||
if [ -z "${EXTENSION_ID}" ] || [ -z "${CLIENT_ID}" ] || [ -z "${CLIENT_SECRET}" ] || [ -z "${REFRESH_TOKEN}" ] || [ -z "${WEB_EXT_API_KEY}" ] || [ -z "${WEB_EXT_API_SECRET}" ]; then | |||
echo "Need to set EXTENSION_ID, CLIENT_ID, CLIENT_SECRET, REFRESH_TOKEN, WEB_EXT_API_KEY and WEB_EXT_API_SECRET env variables to release web extensions" | |||
exit 1 | |||
fi | |||
} | |||
set +o errexit | |||
check_env_variables_are_setted | |||
set -o errexit | |||
set -o pipefail | |||
set -o nounset | |||
function release_web_extensions { | |||
yarn workspace lesspass-web-extension run release | |||
VERSION=$(grep -Po '(?<="version": ")[^"]*' package.json) | |||
echo "Download sources on https://github.com/lesspass/lesspass/releases/tag/${VERSION}" | |||
echo "Upload them on https://addons.mozilla.org/en-US/developers/" | |||
} | |||
release_web_extensions |
@@ -1,13 +1,57 @@ | |||
#!/usr/bin/env bash | |||
RED='\033[0;31m' | |||
NOCOLOR='\033[0m' | |||
function print_error { | |||
echo -e "${RED}$1${NOCOLOR}" | |||
} | |||
function check_current_directory_is_root { | |||
if [ ! -f README.md ]; then | |||
print_error "You seems to be in the wrong directory" | |||
print_error "Execute this script from the root of lesspass with ./bin/${0##*/}" | |||
exit 1 | |||
fi | |||
} | |||
function check_repository_is_clean { | |||
git remote update | |||
git add . | |||
git status | |||
git diff-index --quiet HEAD --; | |||
if [ $? == 1 ] | |||
then | |||
print_error "Git repository not clean. Aborting." | |||
exit 1 | |||
fi | |||
} | |||
function check_branch_is_master { | |||
BRANCH_NAME=$(git branch | grep \* | cut -d ' ' -f2) | |||
if [ $BRANCH_NAME != "master" ] | |||
then | |||
print_error "Current branch is not master. Aborting." | |||
exit 1 | |||
fi | |||
} | |||
function check_bump_type_is_defined { | |||
bump_type="${1}" | |||
if [ "${bump_type}" != "major" ] && [ "${bump_type}" != "minor" ] && [ "${bump_type}" != "patch" ] | |||
then | |||
print_error "Error: No bump type specified (major, minor, patch). Aborting." | |||
exit 1 | |||
fi | |||
} | |||
set +o errexit | |||
git diff-index --quiet HEAD | |||
if [ $? == 1 ] | |||
then | |||
echo >&2 "Git repository not clean. Aborting." | |||
exit 1 | |||
fi | |||
check_branch_is_master | |||
bump_type="${1:-}" | |||
check_bump_type_is_defined ${bump_type} | |||
check_current_directory_is_root | |||
check_repository_is_clean | |||
set -o errexit | |||
set -o pipefail | |||
@@ -60,7 +104,20 @@ function replace_versions_in_files { | |||
sed -i "s/\"version\": \"${1}\"/\"version\": \"${2}\"/g" packages/lesspass-web-extension/package.json | |||
sed -i "s/\"lesspass-pure\": \"${1}\"/\"lesspass-pure\": \"${2}\"/g" packages/lesspass-web-extension/package.json | |||
sed -i "s/\"version\": \"${1}\"/\"version\": \"${2}\"/g" packages/lesspass-web-extension/extension/manifest.json | |||
sed -i "s/VERSION=\"${1}\"/VERSION=\"${2}\"/g" containers/deploy | |||
} | |||
function build_web_extensions { | |||
yarn install | |||
yarn workspace lesspass-pure run build | |||
rm -rf packages/lesspass-web-extension/extension/dist | |||
mkdir packages/lesspass-web-extension/extension/dist | |||
cp -r packages/lesspass-pure/dist/. packages/lesspass-web-extension/extension/dist/ | |||
} | |||
function build_mobile_app { | |||
pushd mobile/android/ | |||
./gradlew assembleRelease | |||
popd | |||
} | |||
function tag { | |||
@@ -69,17 +126,9 @@ function tag { | |||
git tag "${1}" | |||
} | |||
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | |||
__root="$(cd "$(dirname "${__dir}")" && pwd)" | |||
pushd ${__root} | |||
bump_type="${1:-}" | |||
if [ "${bump_type}" == "major" ] || [ "${bump_type}" == "minor" ] || [ "${bump_type}" == "patch" ] | |||
then | |||
current_version=$(grep -Po '(?<="version": ")[^"]*' package.json) | |||
new_version=$( increment_version ${current_version} ${bump_type} ) | |||
replace_versions_in_files ${current_version} ${new_version} | |||
tag ${new_version} | |||
else | |||
echo >&2 "Error: No bump type specified (major, minor, patch). Aborting." | |||
exit 1 | |||
fi | |||
current_version=$( grep -Po '(?<="version": ")[^"]*' package.json ) | |||
new_version=$( increment_version ${current_version} ${bump_type} ) | |||
replace_versions_in_files ${current_version} ${new_version} | |||
build_web_extensions | |||
build_mobile_app | |||
tag ${new_version} |
@@ -1,54 +0,0 @@ | |||
#!/usr/bin/env bash | |||
set +o errexit | |||
function check_branch_is_master { | |||
BRANCH_NAME=$(git branch | grep \* | cut -d ' ' -f2) | |||
if [ $BRANCH_NAME != "master" ] | |||
then | |||
echo >&2 "Current branch is not master. Aborting." | |||
exit 1 | |||
fi | |||
} | |||
function check_tag_is_present { | |||
git describe --exact-match --tags | |||
if [ $? != 0 ] | |||
then | |||
echo >&2 "Current revision is not tagged. Aborting." | |||
exit 1 | |||
fi | |||
} | |||
function check_repository_is_clean { | |||
git remote update | |||
git status | |||
git diff-index --quiet HEAD --; | |||
if [ $? == 1 ] | |||
then | |||
echo >&2 "Git repository not clean. Aborting." | |||
exit 1 | |||
fi | |||
} | |||
function check_env_variables_setted { | |||
if [ -z "$EXTENSION_ID" ] || [ -z "$CLIENT_ID" ] || [ -z "$CLIENT_SECRET" ] || [ -z "$REFRESH_TOKEN" ] || [ -z "$WEB_EXT_API_KEY" ] || [ -z "$WEB_EXT_API_SECRET" ]; then | |||
echo "Need to set EXTENSION_ID, CLIENT_ID, CLIENT_SECRET, REFRESH_TOKEN, WEB_EXT_API_KEY and WEB_EXT_API_SECRET env variables to release web extensions" | |||
exit 1 | |||
fi | |||
} | |||
check_branch_is_master | |||
check_tag_is_present | |||
check_env_variables_setted | |||
yarn workspace lesspass-web-extension run build | |||
yarn workspace lesspass-pure run build | |||
check_repository_is_clean | |||
set -o errexit | |||
set -o pipefail | |||
set -o nounset | |||
yarn workspace lesspass-web-extension run release | |||
VERSION=$(grep -Po '(?<="version": ")[^"]*' package.json) | |||
echo "See the new release on https://github.com/lesspass/lesspass/releases/tag/${VERSION}" |
@@ -1,14 +0,0 @@ | |||
#!/usr/bin/env bash | |||
set -e | |||
build_and_push () { | |||
PROJECT=$1 | |||
docker build --tag lesspass/${PROJECT} ./${PROJECT} | |||
docker tag lesspass/${PROJECT} quay.io/lesspass/${PROJECT} | |||
docker push quay.io/lesspass/${PROJECT} | |||
} | |||
docker login --username="${QUAY_USERNAME}" --password="${QUAY_PASSWORD}" quay.io | |||
build_and_push webserver | |||
build_and_push backend | |||
build_and_push frontend |
@@ -1,15 +0,0 @@ | |||
#!/usr/bin/env bash | |||
set -e | |||
install_and_publish () { | |||
PROJECT=$1 | |||
pushd ${PROJECT} | |||
yarn publish | |||
popd | |||
} | |||
projects="lesspass lesspass-crypto lesspass-entropy lesspass-fingerprint lesspass-pure lesspass-render-password" | |||
for project in ${projects} | |||
do | |||
install_and_publish ${project} | |||
done |
@@ -0,0 +1,15 @@ | |||
module.exports = { | |||
css: { | |||
extract: { | |||
filename: "lesspass.min.css" | |||
} | |||
}, | |||
configureWebpack: { | |||
output: { | |||
filename: "lesspass.min.js" | |||
}, | |||
optimization: { | |||
splitChunks: false | |||
} | |||
} | |||
}; |
@@ -7,7 +7,6 @@ | |||
"scripts": { | |||
"start": "cd extension && web-ext run", | |||
"test": "echo 0", | |||
"build": "cd ../.. && ./bin/build_web_extensions && cd packages/lesspass-web-extension", | |||
"release": "npm run release:cws && npm run release:amo", | |||
"release:amo": "cd extension && web-ext-submit", | |||
"release:cws": "cd extension && webstore upload --auto-publish" | |||