diff --git a/actions/deploy-develop/Dockerfile b/.github/actions/deploy/Dockerfile similarity index 73% rename from actions/deploy-develop/Dockerfile rename to .github/actions/deploy/Dockerfile index 8e45551fe..b6a5127f7 100644 --- a/actions/deploy-develop/Dockerfile +++ b/.github/actions/deploy/Dockerfile @@ -4,5 +4,7 @@ RUN dpkg --add-architecture i386 RUN apt update RUN apt -y install python make libxkbfile-dev libxkbfile-dev:i386 libx11-dev libx11-dev:i386 libxss-dev gcc-multilib g++-multilib rpm -ADD entrypoint.sh /entrypoint.sh -ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file +COPY "entrypoint.sh" "/entrypoint.sh" +ENTRYPOINT ["/entrypoint.sh"] + +CMD [""] \ No newline at end of file diff --git a/.github/actions/deploy/deploy.yml b/.github/actions/deploy/deploy.yml new file mode 100644 index 000000000..c86272158 --- /dev/null +++ b/.github/actions/deploy/deploy.yml @@ -0,0 +1,23 @@ +name: 'Deploy Simplenote' +description: 'Builds and deploys Simplenote to VIP Go branches' +branding: + icon: 'truck' + color: 'green' +inputs: + APP_ID: + description: 'Application ID' + required: true + GITHUB_TOKEN: + description: 'GitHub Token' + requried: true + BRANCH: + description: 'Branch' + required: true +runs: + using: 'docker' + image: 'Dockerfile' + entrypoint: './.github/actions/deploy/entrypoint.sh' + env: + APP_ID: ${{ inputs.APP_ID }} + GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }} + BRANCH: ${{ inputs.BRANCH }} diff --git a/.github/actions/deploy/entrypoint.sh b/.github/actions/deploy/entrypoint.sh new file mode 100755 index 000000000..f519f9ba5 --- /dev/null +++ b/.github/actions/deploy/entrypoint.sh @@ -0,0 +1,66 @@ +#!/bin/sh -l + +COMMIT_BRANCH='' +WEB_APP_URL='' +APP_ENGINE_URL='' + +case $BRANCH in + + "refs/heads/develop") + COMMIT_BRANCH='webapp-develop' + WEB_APP_URL='https://simplenote-develop.go-vip.net' + APP_ENGINE_URL='https://develop.simplenote.com' + ;; + + "refs/heads/master") + COMMIT_BRANCH='webapp' + WEB_APP_URL='https://simplenote.go-vip.co' + APP_ENGINE_URL='https://app.simplenote.com' + ;; + + *) + exit 0 + ;; +esac + +# Install Node Modules +npm install + +#Setup config-local to override config +json_string=$(printf '{"app_id": "%s", "app_key": "12345", "development": false, "wpcc_client_id": "0", "wpcc_redirect_url": "https://simplenote.com", "is_app_engine": true, "web_app_url": "%s", "app_engine_url": "%s"}' "$APP_ID" "$WEB_APP_URL" "$APP_ENGINE_URL") +echo "$json_string" > config-local.json + +# Build site +NODE_ENV=production make build + +# Variables +ORIGIN_URL=$(git config --get remote.origin.url) + +# Checkout deploy branch +if [ "$(git branch | grep $COMMIT_BRANCH)" ] +then + git branch -D $COMMIT_BRANCH +fi +git checkout -b $COMMIT_BRANCH + +# Delete files not needed in production +find . -maxdepth 1 ! -name '.git' ! -name 'dist' ! -name 'vip' -exec rm -rf {} \; + +# Copy vip files to base path +cp -r vip/* ./ + +# Delete uneeded vip folder +rm -rf vip + +# Push to deploy +git config user.name "GitHub Actions" +git config user.email "github-actions-bot@users.noreply.github.com" + +git add --all +git commit -m "Build: $COMMIT_BRANCH [ci skip]" +git remote set-url origin https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} +git push -f origin $COMMIT_BRANCH + +echo "Deployed Successfully!" + +exit 0 \ No newline at end of file diff --git a/.github/main.workflow b/.github/main.workflow deleted file mode 100644 index 50dec151d..000000000 --- a/.github/main.workflow +++ /dev/null @@ -1,22 +0,0 @@ -workflow "Build and Push to WebApp" { - on = "push" - resolves = [] -} - -action "Deploy Develop" { - uses = "./actions/deploy-develop" - secrets = ["GITHUB_TOKEN", "APP_ID"] - env = { - PUSHED_BRANCH = "develop" - COMMIT_BRANCH = "webapp-develop" - } -} - -action "Deploy Master" { - uses = "./actions/deploy-master" - secrets = ["GITHUB_TOKEN", "APP_ID"] - env = { - PUSHED_BRANCH = "develop" - COMMIT_BRANCH = "webapp-staging" - } -} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 000000000..716123fb7 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,16 @@ +on: + push: + branches: + - master + - develop + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: ./.github/actions/deploy + env: + APP_ID: ${{ secrets.APP_ID }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRANCH: ${{ github.ref }} diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index 53cd16b6c..a1e2f71f5 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -11,6 +11,8 @@ - Updated colors to use Color Studio, the color palette for Automattic products - Fixes vertical spacing with nested markdown lists - Add ability to select system as a theme option and make it the default +- Added a GitHub Action to deploy develop and master branches +- Fixes sort order on revision slider when the timestamps don't match the change sequence [#1605](https://github.com/Automattic/simplenote-electron/pull/1605) ## [v1.7.0](https://github.com/Automattic/simplenote-electron/releases/tag/v1.7.0) (2019-08-12) diff --git a/actions/deploy-develop/README.md b/actions/deploy-develop/README.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/actions/deploy-develop/entrypoint.sh b/actions/deploy-develop/entrypoint.sh deleted file mode 100755 index febd24521..000000000 --- a/actions/deploy-develop/entrypoint.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh -l - -# Check branch -if [ `git rev-parse --abbrev-ref HEAD` != "$PUSHED_BRANCH" ] -then - exit 0 -fi - -# Install Node Modules -npm install - -#Setup config-local to override config -json='{"app_id": "%s", "app_key": "12345", "development": false, "wpcc_client_id": "0", "wpcc_redirect_url": "https://simplenote.com", "is_app_engine": true, "web_app_url": "https://simplenote-develop.go-vip.net", "app_engine_url": "https://develop.simplenote.com"}' -json_string=$(printf "$json" "$APP_ID") -echo $json_string > config-local.json - -# Build site -NODE_ENV=production make build - -# Variables -ORIGIN_URL=`git config --get remote.origin.url` - -# Checkout deploy branch -if [ `git branch | grep $COMMIT_BRANCH` ] -then - git branch -D $COMMIT_BRANCH -fi -git checkout -b $COMMIT_BRANCH - -# Delete files not needed in production -find . -maxdepth 1 ! -name '.git' ! -name 'dist' ! -name 'vip' -exec rm -rf {} \; - -# Copy vip files to base path -cp -r vip/* ./ - -# Delete uneeded vip folder -rm -rf vip - -# Push to deploy -git config user.name "GitHub Actions" -git config user.email "github-actions-bot@users.noreply.github.com" - -git add --all -git commit -m "Build: $COMMIT_BRANCH [ci skip]" -git push -f $ORIGIN_URL $COMMIT_BRANCH - -echo "Deployed Successfully!" - -exit 0 \ No newline at end of file diff --git a/actions/deploy-master/Dockerfile b/actions/deploy-master/Dockerfile deleted file mode 100644 index 8e45551fe..000000000 --- a/actions/deploy-master/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM node:10.16.3-jessie - -RUN dpkg --add-architecture i386 -RUN apt update -RUN apt -y install python make libxkbfile-dev libxkbfile-dev:i386 libx11-dev libx11-dev:i386 libxss-dev gcc-multilib g++-multilib rpm - -ADD entrypoint.sh /entrypoint.sh -ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/actions/deploy-master/README.md b/actions/deploy-master/README.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/actions/deploy-master/entrypoint.sh b/actions/deploy-master/entrypoint.sh deleted file mode 100755 index c5e315b3e..000000000 --- a/actions/deploy-master/entrypoint.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh -l - -# Check branch -if [ `git rev-parse --abbrev-ref HEAD` != "$PUSHED_BRANCH" ] -then - exit 0 -fi - -# Install Node Modules -npm install - -#Setup config-local to override config -json='{"app_id": "%s", "app_key": "12345", "development": false, "wpcc_client_id": "0", "wpcc_redirect_url": "https://simplenote.com", "is_app_engine": true, "web_app_url": "https://simplenote.go-vip.co", "app_engine_url": "https://app.simplenote.com"}' -json_string=$(printf "$json" "$APP_ID") -echo $json_string > config-local.json - -# Build site -NODE_ENV=production make build - -# Variables -ORIGIN_URL=`git config --get remote.origin.url` - -# Checkout deploy branch -if [ `git branch | grep $COMMIT_BRANCH` ] -then - git branch -D $COMMIT_BRANCH -fi -git checkout -b $COMMIT_BRANCH - -# Delete files not needed in production -find . -maxdepth 1 ! -name '.git' ! -name 'dist' ! -name 'vip' -exec rm -rf {} \; - -# Copy vip files to base path -cp -r vip/* ./ - -# Delete uneeded vip folder -rm -rf vip - -# Push to deploy -git config user.name "GitHub Actions" -git config user.email "github-actions-bot@users.noreply.github.com" - -git add --all -git commit -m "Build: $COMMIT_BRANCH [ci skip]" -git push -f $ORIGIN_URL $COMMIT_BRANCH - -echo "Deployed Successfully!" - -exit 0 \ No newline at end of file diff --git a/lib/revision-selector/index.jsx b/lib/revision-selector/index.jsx index 0b7ac18cc..7aa5d5e19 100644 --- a/lib/revision-selector/index.jsx +++ b/lib/revision-selector/index.jsx @@ -9,8 +9,7 @@ import Slider from '../components/slider'; import appState from '../flux/app-state'; import { updateNoteTags } from '../state/domain/notes'; -const sortedRevisions = revisions => - orderBy(revisions, 'data.modificationDate', 'asc'); +const sortedRevisions = revisions => orderBy(revisions, 'version', 'asc'); export class RevisionSelector extends Component { static propTypes = { diff --git a/lib/simperium/index.js b/lib/simperium/index.js index 6a83cda27..917a9df36 100644 --- a/lib/simperium/index.js +++ b/lib/simperium/index.js @@ -5,8 +5,6 @@ import localQueueStore from './local-queue-store'; import util from 'util'; import events from 'events'; -const Bucket = Client.Bucket; - export const Auth = simperium.Auth; export default function(settings) { @@ -19,7 +17,7 @@ export default function(settings) { return browserClient; } -Bucket.prototype.query = function(fn) { +Client.Bucket.prototype.query = function(fn) { this.store.setup.then(fn); };