diff --git a/.circleci/config.yml b/.circleci/config.yml index 6c72ec9c76..a11b543fb1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -259,6 +259,17 @@ jobs: paths: - android-prod.apk + deploy-branch: + <<: *defaults + steps: + - checkout + - attach_workspace: + at: ~/repo + - deploy: + name: Branch Deploy + command: | + ./deploy.sh branch "${CIRCLE_BRANCH}" + deploy-dev: <<: *defaults steps: @@ -268,7 +279,7 @@ jobs: - deploy: name: Dev Deploy command: | - ./deploy.sh "${CIRCLE_BRANCH}" "${CIRCLE_BRANCH}" + ./deploy.sh dev "${CIRCLE_BRANCH}" deploy-release: <<: *defaults @@ -279,7 +290,7 @@ jobs: - deploy: name: Release Deploy command: | - ./deploy.sh "${CIRCLE_BRANCH}" release + ./deploy.sh release "${CIRCLE_BRANCH}" sync-locale-messages: <<: *defaults @@ -350,8 +361,9 @@ workflows: - build-dev: filters: branches: - only: - - master + ignore: + - circleci-update-locales + - /dependabot\/.*/ requires: - install-dependencies - build-storybook: @@ -390,6 +402,15 @@ workflows: requires: - build-android-dev - test + - deploy-branch: + filters: + branches: + ignore: + - master + - circleci-update-locales + - /dependabot\/.*/ + requires: + - build-dev - deploy-dev: filters: branches: diff --git a/deploy.sh b/deploy.sh index 23ac2198a5..12d00e438a 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,35 +1,43 @@ #!/bin/bash -set -e +set -eu -HOST=yuca.yunity.org +HOST="yuca.yunity.org" -REF=$1 -DIR=$2 +TYPE="$1" +REF="${2:-master}" -if [ -z "$REF" ] || [ -z "$DIR" ]; then - echo "Usage: " +# optionally available from the environment +SLACK_WEBHOOK_URL="${SLACK_WEBHOOK_URL:-}" + +if [ -z "$REF" ]; then + echo "Usage: []" exit 1 fi -ISO_DATE=$(date -Idate) -REPO_URL="https://github.com/yunity/karrot-frontend" -COMMIT_SHA=$(git rev-parse HEAD) -COMMIT_SHA_SHORT=$(git rev-parse --short HEAD) - -if [ "$DIR" == "release" ]; then +if [ "$TYPE" == "release" ]; then # release + DIR="release" DEPLOY_ENV="production" DEPLOY_EMOJI=":rocket:" URL="https://karrot.world" APK_URL="https://karrot.world/app.apk" -elif [ "$REF" == "master" ]; then +elif [ "$TYPE" == "dev" ]; then # dev + if [ "$REF" != "master" ]; then + # technically we could deploy other branches + # but the dir name is setup to be "master" + echo "Error: dev deployment must be of master branch" + echo "(it could be implemented that you can deploy other branches, but is not right now)" + exit 1 + fi + + DIR="master" DEPLOY_ENV="development" DEPLOY_EMOJI=":beer:" URL="https://dev.karrot.world" @@ -37,15 +45,36 @@ elif [ "$REF" == "master" ]; then STORYBOOK_URL="https://storybook.karrot.world" DEPLOY_DOCS="true" -else +elif [ "$TYPE" == "branch" ]; then - # nothing + if [ -z "$REF" ]; then + echo "Error: you must specify ref for branch releases" + echo "Usage: []" + exit 1 + fi - exit 0 + # branch deployment -fi + SAFE_DIR="$(echo -n "$REF" | tr -c '[a-zA-Z0-9]_-' '_' | tr "[:upper:]" "[:lower:]")" + DIR="branches/$SAFE_DIR" + DEPLOY_ENV="branch/$REF" + DEPLOY_EMOJI=":construction_worker:" + URL="https://$REF.dev.karrot.world" + APK_URL= + STORYBOOK_URL= + DEPLOY_DOCS="true" +else + + echo "Invalid type, must be one of release|dev|branch" + exit 1 +fi + +ISO_DATE=$(date -Idate) +REPO_URL="https://github.com/yunity/karrot-frontend" +COMMIT_SHA=$(git rev-parse HEAD) +COMMIT_SHA_SHORT=$(git rev-parse --short HEAD) REF_URL="$REPO_URL/tree/$REF" COMMIT_URL="$REPO_URL/tree/$COMMIT_SHA" @@ -64,11 +93,14 @@ about_json=$(printf '{ }' "$COMMIT_SHA" "$COMMIT_SHA_SHORT" "$REF" "$DEPLOY_ENV" "$APK_URL" "$ISO_DATE") echo "$about_json" > dist/about.json -echo "$about_json" > storybook-static/about.json # send it all to the host rsync -avz --delete dist/ "deploy@$HOST:karrot-frontend/$DIR/" -rsync -avz --delete storybook-static/ "deploy@$HOST:karrot-frontend-storybook/$DIR/" + +if [ ! -z "$STORYBOOK_URL" ]; then + echo "$about_json" > storybook-static/about.json + rsync -avz --delete storybook-static/ "deploy@$HOST:karrot-frontend-storybook/$DIR/" +fi if [ "$DEPLOY_DOCS" == "true" ] && [ -d docs-dist/gitbook ]; then rsync -avz --delete docs-dist/ "deploy@$HOST:karrot-docs/$DIR/" diff --git a/src/base/datastore/routerPlugin.js b/src/base/datastore/routerPlugin.js index 2e11e26125..ed34d58598 100644 --- a/src/base/datastore/routerPlugin.js +++ b/src/base/datastore/routerPlugin.js @@ -29,9 +29,6 @@ export default datastore => { if (groupId) { next = { name: 'group', params: { groupId } } } - else { - next = { name: 'groupsGallery' } - } } // check meta.requireLoggedIn diff --git a/src/base/pages/Landing.vue b/src/base/pages/Landing.vue new file mode 100644 index 0000000000..102ac57612 --- /dev/null +++ b/src/base/pages/Landing.vue @@ -0,0 +1,343 @@ + + + + + diff --git a/src/base/pages/Root.vue b/src/base/pages/Root.vue index dbacfb0c02..f61b237d50 100644 --- a/src/base/pages/Root.vue +++ b/src/base/pages/Root.vue @@ -34,6 +34,11 @@ export default {