Merge branch 'release/@standardnotes/app-monorepo@0.0.1'

This commit is contained in:
Mo
2022-06-16 13:52:12 -05:00
5817 changed files with 159211 additions and 178664 deletions

View File

@@ -1,5 +1,10 @@
# git
.git/
.gitignore
.eslintcache
node_modules
public/assets
dist
packages/web-server/public/assets
packages/web-server/tmp
packages/web-server/vendor/bundles
packages/desktop
packages/mobile

10
.editorconfig Normal file
View File

@@ -0,0 +1,10 @@
root = true
[*]
end_of_line = lf
insert_final_newline = true
[*.{js,json,yml}]
charset = utf-8
indent_style = space
indent_size = 2

2
.eslintignore Normal file
View File

@@ -0,0 +1,2 @@
node_modules
scripts

View File

@@ -1,39 +0,0 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"plugin:react-hooks/recommended",
"./node_modules/@standardnotes/config/src/.eslintrc"
],
"plugins": ["@typescript-eslint", "react", "react-hooks"],
"parserOptions": {
"project": "./app/assets/javascripts/tsconfig.json"
},
"ignorePatterns": [".eslintrc.js", "webpack.*.js", "webpack-defaults.js", "jest.config.js", "__mocks__"],
"rules": {
"standard/no-callback-literal": 0, // Disable this as we have too many callbacks relying on literals
"no-throw-literal": 0,
"no-console": "off",
"semi": 1,
"camelcase": "warn",
"sort-imports": "off",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "error",
"eol-last": "error",
"no-multiple-empty-lines": ["error", { "max": 1, "maxEOF": 0 }],
"no-trailing-spaces": "error",
"@typescript-eslint/no-explicit-any": "warn",
"no-invalid-this": "warn"
},
"env": {
"browser": true
},
"globals": {
"SFJS": true,
"__VERSION__": true,
"zip": true
}
}

4
.eslintrc.json Normal file
View File

@@ -0,0 +1,4 @@
{
"extends": ["./node_modules/@standardnotes/config/src/.eslintrc"],
"ignorePatterns": [".eslintrc.js", "*.webpack.*.js", "webpack-defaults.js", "jest.config.js", "__mocks__"]
}

View File

@@ -5,8 +5,12 @@ queries:
- uses: ./.github/codeql/custom-queries/javascript
paths:
- app/assets/javascripts
- packages/web/src/javascripts
- packages/desktop/app
paths-ignore:
- bin
- node_modules
- build
- dist
- packages/desktop/app/dist

View File

@@ -1,73 +0,0 @@
name: Beta
on:
push:
branches: [ beta/* ]
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install dependencies
run: yarn install --pure-lockfile
- name: Bundle
run: yarn bundle
- name: ESLint
run: yarn lint
- name: Test
run: yarn test
deploy:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v2
- name: Copy robots.txt
run: cp public/robots.txt.development public/robots.txt
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: standardnotes/web
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tags: "beta,${{ github.sha }}"
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Download task definition
run: |
aws ecs describe-task-definition --task-definition app-beta-dev --query taskDefinition > task-definition.json
- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: task-definition.json
container-name: app-beta-dev
image: "standardnotes/web:${{ github.sha }}"
- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: app-beta-dev
cluster: dev
wait-for-service-stability: true
notify_discord:
needs: deploy
runs-on: ubuntu-latest
steps:
- name: Run Discord Webhook
uses: johnnyhuy/actions-discord-git-webhook@main
with:
webhook_url: ${{ secrets.DISCORD_WEBHOOK_URL }}

View File

@@ -22,6 +22,7 @@ on:
jobs:
analyze:
if: contains(github.event.head_commit.message, 'chore(release)') == false
name: Analyze
runs-on: ubuntu-latest

View File

@@ -0,0 +1,15 @@
name: Desktop Beta Release
on:
push:
tags:
- '@standardnotes/desktop@[0-9]*.[0-9]*.[0-9]*-alpha.[0-9]*'
- '@standardnotes/desktop@[0-9]*.[0-9]*.[0-9]*-beta.[0-9]*'
workflow_dispatch:
jobs:
Build:
uses: standardnotes/app/.github/workflows/desktop.release.reuse.yml@develop
secrets: inherit
with:
channel: beta

View File

@@ -0,0 +1,14 @@
name: Desktop Prod Release
on:
push:
tags:
- '@standardnotes/desktop@!(*alpha*|*beta*)'
workflow_dispatch:
jobs:
Build:
uses: standardnotes/app/.github/workflows/desktop.release.reuse.yml@main
secrets: inherit
with:
channel: prod

View File

@@ -0,0 +1,177 @@
name: Desktop Reusable Release Workflow
on:
workflow_call:
inputs:
channel:
required: true
type: string
jobs:
Mac:
runs-on: macos-latest
env:
CSC_LINK: ${{ secrets.MAC_CI_KEYS }}
CSC_KEY_PASSWORD: ${{ secrets.MAC_CI_KEYS_PASSWORD }}
NOTARIZE_APPLE_ID: ${{ secrets.NOTARIZE_APPLE_ID }}
NOTARIZE_APPLE_ID_PASSWORD: ${{ secrets.NOTARIZE_APPLE_ID_PASSWORD }}
defaults:
run:
working-directory: packages/desktop
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
registry-url: 'https://registry.npmjs.org'
- run: yarn install
- run: yarn build:desktop
- name: Compile Mac
run: yarn run webpack --config desktop.webpack.prod.js
- name: MacX64
run: |
yarn run electron-builder --mac --x64 --publish=never
node scripts/fixMacZip.js
- name: MacArm64
run: yarn run electron-builder --mac --arm64 --publish=never
- name: Upload
uses: actions/upload-artifact@v3.0.0
with:
name: assets
path: |
packages/desktop/dist/*.dmg
packages/desktop/dist/*.zip
packages/desktop/dist/*.blockmap
packages/desktop/dist/*.yml
packages/desktop/dist/*.yaml
Linux:
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/desktop
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
registry-url: 'https://registry.npmjs.org'
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- name: Install FPM
run: sudo gem install fpm -f
- run: yarn install
- run: yarn build:desktop
- name: Compile for AppImage
run: yarn run webpack --config desktop.webpack.prod.js
- name: AppImage
run: yarn run electron-builder --linux --x64 --ia32 -c.linux.target=AppImage --publish=never
- name: AppImageX64
run: yarn run electron-builder --linux --x64 -c.linux.target=AppImage --publish=never
- name: AppImageArm64
run: yarn run electron-builder --linux --arm64 -c.linux.target=AppImage --publish=never
- name: Deb
run: |
yarn run webpack --config desktop.webpack.prod.js --env deb
yarn run electron-builder --linux --x64 --ia32 -c.linux.target=deb --publish=never
- name: DebArm64
env:
npm_config_target_arch: 'arm64'
USE_SYSTEM_FPM: 'true'
run: |
yarn run webpack --config desktop.webpack.prod.js --env deb
yarn run electron-builder --linux --arm64 -c.linux.target=deb --publish=never
- name: Dir
run: |
yarn run webpack --config desktop.webpack.prod.js
yarn run electron-builder --linux --x64 -c.linux.target=dir --publish=never
- name: DirArm64
run: |
yarn run webpack --config desktop.webpack.prod.js
yarn run electron-builder --linux --arm64 -c.linux.target=dir --publish=never
env:
npm_config_target_arch: 'arm64'
- name: Snap
run: |
sudo snap install snapcraft --classic
yarn run webpack --config desktop.webpack.prod.js --env snap
yarn run electron-builder --linux --x64 -c.linux.target=snap --publish=never
- name: Upload
uses: actions/upload-artifact@v3.0.0
with:
name: assets
path: |
packages/desktop/dist/*.snap
packages/desktop/dist/*.AppImage
packages/desktop/dist/*.deb
packages/desktop/dist/*.blockmap
packages/desktop/dist/*.yml
packages/desktop/dist/*.yaml
Windows:
runs-on: self-hosted
env:
WINDOWS_TOKEN_ALIAS: ${{ secrets.WINDOWS_TOKEN_ALIAS }}
WINDOWS_TOKEN_PASSWORD: ${{ secrets.WINDOWS_TOKEN_PASSWORD }}
defaults:
run:
working-directory: packages/desktop
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
registry-url: 'https://registry.npmjs.org'
- run: yarn install
- run: yarn build:desktop
- run: yarn run webpack --config desktop.webpack.prod.js
- run: yarn run electron-builder --windows --x64 --ia32 --publish=never
- name: Upload
uses: actions/upload-artifact@v3.0.0
with:
name: assets
path: |
packages/desktop/dist/*.blockmap
packages/desktop/dist/*.exe
packages/desktop/dist/*.yml
packages/desktop/dist/*.yaml
Publish:
runs-on: ubuntu-latest
if: ${{ always() }}
needs: [Windows, Mac, Linux]
defaults:
run:
working-directory: packages/desktop
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
registry-url: 'https://registry.npmjs.org'
- uses: actions/download-artifact@v3
with:
name: assets
path: packages/desktop/dist
- run: node scripts/sums.mjs
- name: get-npm-version
id: package-version
uses: martinbeentjes/npm-get-version-action@main
with:
path: packages/desktop
- name: Release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.CI_PAT_TOKEN }}
tag_name: "@standardnotes/desktop@${{ steps.package-version.outputs.current-version}}"
prerelease: true
draft: true
name: "Desktop ${{ inputs.channel == 'beta' && 'Beta' || '' }} ${{ steps.package-version.outputs.current-version}}"
files: packages/desktop/dist/*
- name: Publish Snap
continue-on-error: true
run: |
echo "${{ secrets.SNAPCRAFT_LOGIN_FILE }}" >> snapauth.txt
snapcraft login --with=snapauth.txt
snapcraft upload dist/standard-notes-${{ steps.package-version.outputs.current-version}}-linux-amd64.snap

View File

@@ -0,0 +1,55 @@
name: Desktop Windows Sign & Release
on:
workflow_dispatch:
jobs:
Windows:
runs-on: self-hosted
env:
WINDOWS_TOKEN_ALIAS: ${{ secrets.WINDOWS_TOKEN_ALIAS }}
WINDOWS_TOKEN_PASSWORD: ${{ secrets.WINDOWS_TOKEN_PASSWORD }}
defaults:
run:
working-directory: packages/desktop
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
registry-url: 'https://registry.npmjs.org'
- run: yarn install
- run: yarn build:desktop
- run: yarn run webpack --config desktop.webpack.prod.js
- run: yarn run electron-builder --windows --x64 --ia32 --publish=never
- name: Upload
uses: actions/upload-artifact@v3.0.0
with:
name: assets
path: |
packages/desktop/dist/*.blockmap
packages/desktop/dist/*.exe
packages/desktop/dist/*.yml
packages/desktop/dist/*.yaml
Publish:
runs-on: ubuntu-latest
needs: [Windows]
defaults:
run:
working-directory: packages/desktop
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
registry-url: 'https://registry.npmjs.org'
- uses: actions/download-artifact@v3
with:
name: assets
path: packages/desktop/dist
- name: get-npm-version
id: package-version
uses: martinbeentjes/npm-get-version-action@main
with:
path: packages/desktop

View File

@@ -1,84 +0,0 @@
name: Dev
concurrency:
group: dev_environment
cancel-in-progress: true
on:
push:
branches: [ develop ]
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install dependencies
run: yarn install --pure-lockfile
- name: Bundle
run: yarn bundle
- name: ESLint
run: yarn lint
- name: Test
run: yarn test
deploy:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v2
- name: Copy robots.txt
run: cp public/robots.txt.development public/robots.txt
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: standardnotes/web
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tags: "latest,${{ github.sha }}"
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Download task definition
run: |
aws ecs describe-task-definition --task-definition app-dev --query taskDefinition > task-definition.json
- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: task-definition.json
container-name: app-dev
image: "standardnotes/web:${{ github.sha }}"
- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: app-dev
cluster: dev
wait-for-service-stability: true
notify_discord:
needs: deploy
runs-on: ubuntu-latest
steps:
- name: Run Discord Webhook
uses: johnnyhuy/actions-discord-git-webhook@main
with:
webhook_url: ${{ secrets.DISCORD_WEBHOOK_URL }}

View File

@@ -6,8 +6,8 @@ jobs:
- name: git-sync
uses: wei/git-sync@v3
with:
source_repo: "standardnotes/web"
source_repo: "standardnotes/app"
source_branch: "refs/remotes/source/*"
destination_repo: "standardnotes/private-web"
destination_repo: "standardnotes/internal-app"
destination_branch: "refs/heads/*"
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}

100
.github/workflows/mobile.release.dev.yml vendored Normal file
View File

@@ -0,0 +1,100 @@
name: Mobile Build Development
on:
push:
tags:
- '@standardnotes/mobile@[0-9]*.[0-9]*.[0-9]*-alpha.[0-9]*'
- '@standardnotes/mobile@[0-9]*.[0-9]*.[0-9]*-beta.[0-9]*'
workflow_dispatch:
jobs:
android:
defaults:
run:
working-directory: packages/mobile
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Export version from package.json
run: |
echo "PACKAGE_VERSION=$(grep '"version"' package.json | cut -d '"' -f 4 | cut -d "-" -f 1)" >> $GITHUB_ENV
- name: Setup react-native kernel and increase watchers
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
- name: Decode Dev Android keystore
run: |
echo "${{ secrets.DEV_KEYSTORE }}" > keystore.keystore.asc
gpg -d --passphrase "${{ secrets.DEV_KEYSTORE_PASSPHRASE }}" --batch keystore.keystore.asc > android/app/keystore.keystore
- name: Ruby Setup for Fastlane
uses: ruby/setup-ruby@v1
- name: Install dependencies
run: yarn install
- run: yarn build:mobile
- name: fastlane
uses: maierj/fastlane-action@v1.4.0
env:
PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }}
BUILD_NUMBER: ${{ github.run_number }}
ANDROID_KEYSTORE_ALIAS: ${{ secrets.DEV_ANDROID_KEYSTORE_ALIAS }}
ANDROID_KEYSTORE_PRIVATE_KEY_PASSWORD: ${{ secrets.DEV_ANDROID_KEYSTORE_PRIVATE_KEY_PASSWORD }}
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.DEV_ANDROID_KEYSTORE_PASSWORD }}
GOOGLE_PLAY_JSON_KEY_DATA: ${{ secrets.GOOGLE_PLAY_JSON_KEY_DATA }}
with:
lane: 'android dev'
subdirectory: 'packages/mobile'
- name: Upload universal apk to artifacts
uses: actions/upload-artifact@v2
with:
name: dev.apk
path: android/app/build/outputs/apk/dev/release/app-dev-release.apk
ios:
defaults:
run:
working-directory: packages/mobile
runs-on: macos-11
timeout-minutes: 90
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Export version from package.json
run: |
echo "PACKAGE_VERSION=$(grep '"version"' package.json | cut -d '"' -f 4 | cut -d "-" -f 1)" >> $GITHUB_ENV
- name: Ruby Setup for Fastlane
uses: ruby/setup-ruby@v1
- name: Install dependencies
run: yarn install && yarn install:pods
- run: yarn build:mobile
- name: Set ssh connection to Github
uses: webfactory/ssh-agent@v0.4.1
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Export Apple AppStore Connect API key
run: echo "${{ secrets.APPSTORE_CONNECT_KEY }}" > ios/Authkey.p8
- name: Setup fastlane
uses: maierj/fastlane-action@v1.4.0
env:
FASTLANE_USER: ${{ secrets.FASTLANE_USER }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
with:
lane: 'ios setup'
subdirectory: 'packages/mobile'
- name: fastlane
uses: maierj/fastlane-action@v1.4.0
env:
PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }}
APPLE_APP_ID: ${{ secrets.DEV_APP_APPLE_ID }}
APPSTORE_CONNECT_KEY_ID: ${{ secrets.APPSTORE_CONNECT_KEY_ID }}
APPSTORE_CONNECT_KEY_ISSUER_ID: ${{ secrets.APPSTORE_CONNECT_KEY_ISSUER_ID }}
FASTLANE_USER: ${{ secrets.FASTLANE_USER }}
FASTLANE_SESSION: ${{ secrets.FASTLANE_SESSION }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
MATCH_CERTIFICATES_URL: ${{ secrets.MATCH_CERTIFICATES_URL }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }}
MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}
BUILD_NUMBER: ${{ github.run_number }}
with:
lane: 'ios dev'
subdirectory: 'packages/mobile'

View File

@@ -0,0 +1,105 @@
name: Mobile Build Production
on:
push:
tags:
- '@standardnotes/mobile@!(*alpha*|*beta*)'
workflow_dispatch:
jobs:
android:
defaults:
run:
working-directory: packages/mobile
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Export version from package.json
run:
echo "PACKAGE_VERSION=$(grep '"version"' package.json | cut -d '"' -f 4 | cut -d "-" -f 1)" >> $GITHUB_ENV
- name: Setup react-native kernel and increase watchers
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
- name: Decode Production Android keystore
run: |
echo "${{ secrets.ANDROID_KEYSTORE }}" > keystore.keystore.asc
gpg -d --passphrase "${{ secrets.KEYSTORE_PASSPHRASE }}" --batch keystore.keystore.asc > android/app/keystore.keystore
- name: Install dependencies
run: yarn install
- run: yarn build:mobile
- name: Ruby Setup for Fastlane
uses: ruby/setup-ruby@v1
- name: fastlane
uses: maierj/fastlane-action@v1.4.0
env:
PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }}
BUILD_NUMBER: ${{ github.run_number }}
ANDROID_KEYSTORE_ALIAS: ${{ secrets.ANDROID_KEYSTORE_ALIAS }}
ANDROID_KEYSTORE_PRIVATE_KEY_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PRIVATE_KEY_PASSWORD }}
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
GOOGLE_PLAY_JSON_KEY_DATA: ${{ secrets.GOOGLE_PLAY_JSON_KEY_DATA }}
with:
lane: 'android prod'
subdirectory: 'packages/mobile'
- name: Upload universal apk to artifacts
uses: actions/upload-artifact@v2
with:
name: prod.apk
path: android/app/build/outputs/apk/prod/release/app-prod-release.apk
- name: Upload Android App Bundle to artifacts
uses: actions/upload-artifact@v2
with:
name: release.aab
path: android/app/build/outputs/bundle/prodRelease/app-prod-release.aab
ios:
defaults:
run:
working-directory: packages/mobile
runs-on: macos-11
timeout-minutes: 90
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Export version from package.json
run:
echo "PACKAGE_VERSION=$(grep '"version"' package.json | cut -d '"' -f 4 | cut -d "-" -f 1)" >> $GITHUB_ENV
- name: Install dependencies
run: yarn install && yarn install:pods
- run: yarn build:mobile
- name: Set ssh connection to Github
uses: webfactory/ssh-agent@v0.4.1
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Export Apple AppStore Connect API key
run: echo "${{ secrets.APPSTORE_CONNECT_KEY }}" > ios/Authkey.p8
- name: Ruby Setup for Fastlane
uses: ruby/setup-ruby@v1
- name: Setup fastlane
uses: maierj/fastlane-action@v1.4.0
env:
FASTLANE_USER: ${{ secrets.FASTLANE_USER }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
with:
lane: 'ios setup'
subdirectory: 'packages/mobile'
- name: fastlane
uses: maierj/fastlane-action@v1.4.0
env:
PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }}
APPLE_APP_ID: ${{ secrets.APP_APPLE_ID }}
APPSTORE_CONNECT_KEY_ID: ${{ secrets.APPSTORE_CONNECT_KEY_ID }}
APPSTORE_CONNECT_KEY_ISSUER_ID: ${{ secrets.APPSTORE_CONNECT_KEY_ISSUER_ID }}
FASTLANE_USER: ${{ secrets.FASTLANE_USER }}
FASTLANE_SESSION: ${{ secrets.FASTLANE_SESSION }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
MATCH_CERTIFICATES_URL: ${{ secrets.MATCH_CERTIFICATES_URL }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }}
MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}
BUILD_NUMBER: ${{ github.run_number }}
with:
lane: 'ios prod'
subdirectory: 'packages/mobile'

73
.github/workflows/mobile.test.yml vendored Normal file
View File

@@ -0,0 +1,73 @@
name: Mobile e2e
on: [workflow_dispatch]
jobs:
android:
defaults:
run:
working-directory: ./packages/mobile
runs-on: macos-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Download Android Emulator Image
run: |
$ANDROID_HOME/tools/bin/sdkmanager --install "system-images;android-28;default;x86_64"
$ANDROID_HOME/tools/bin/avdmanager create avd -n pixel -d "Nexus 5X" --package "system-images;android-28;default;x86_64"
- name: Install Dependencies
run: yarn install
- name: Add usesCleartextTraffic to release AndroidManifest.xml
run: yarn replace-in-file '<application' '<application android:usesCleartextTraffic="true"' ./android/app/src/main/AndroidManifest.xml
- name: Build for detox
env:
DETOX_CI: true
run: yarn detox build --configuration android.emu.release
- name: Setup Emulator
timeout-minutes: 10
run: |
echo "Starting emulator"
nohup $ANDROID_HOME/emulator/emulator -avd pixel -no-audio -no-snapshot -no-window -gpu swiftshader_indirect &
$ANDROID_HOME/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 1; done; input keyevent 82'
$ANDROID_HOME/platform-tools/adb shell settings put global window_animation_scale 0 &
$ANDROID_HOME/platform-tools/adb shell settings put global transition_animation_scale 0 &
$ANDROID_HOME/platform-tools/adb shell settings put global animator_duration_scale 0 &
echo "Emulator started"
- name: Run tests
run: yarn detox test --configuration android.emu.release
ios:
defaults:
run:
working-directory: ./packages/mobile
runs-on: macos-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Install Dependencies
run: yarn install
- name: Install Pods
run: npx pod-install ios
- name: Install detox dependencies
run: brew tap wix/brew
- name: Install simulator utils
run: brew install applesimutils
- name: Build for detox
run: yarn detox build --configuration ios.sim.release
- name: Run tests
run: yarn detox test --configuration ios.sim.release

38
.github/workflows/pr.components.yml vendored Normal file
View File

@@ -0,0 +1,38 @@
name: Components PR
on:
pull_request:
branches:
- develop
- main
paths:
- packages/components/**
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- name: Install dependencies
run: yarn install
- name: Lint components
run: yarn components:lint
working-directory: packages/components
- name: Compile components
run: yarn components:compile
working-directory: packages/components
- name: Test components
run: yarn components:test
working-directory: packages/components
- name: Lint all
run: yarn lint
- name: Build all
run: yarn build:all
- name: Test all
run: yarn test

View File

@@ -1,10 +1,12 @@
name: Pull request
name: General PR
on:
pull_request:
branches:
- develop
- main
paths:
- packages/!(components)/**
jobs:
test:
@@ -12,11 +14,15 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- name: Install dependencies
run: yarn install --pure-lockfile
- name: Bundle
run: yarn bundle
run: yarn install
- name: ESLint
run: yarn lint
- name: Build
run: yarn build:all
- name: Build Android
run: yarn android:bundle
- name: Test
run: yarn test

View File

@@ -1,82 +0,0 @@
name: Prod
concurrency:
group: prod_environment
cancel-in-progress: true
on:
push:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install dependencies
run: yarn install --pure-lockfile
- name: Bundle
run: yarn bundle
- name: ESLint
run: yarn lint
- name: Test
run: yarn test
deploy:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v2
- name: Copy robots.txt
run: cp public/robots.txt.production public/robots.txt
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: standardnotes/web
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tags: "stable,${{ github.sha }}"
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Download task definition
run: |
aws ecs describe-task-definition --task-definition app-prod --query taskDefinition > task-definition.json
- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: task-definition.json
container-name: app-prod
image: "standardnotes/web:${{ github.sha }}"
- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: app-prod
cluster: prod
wait-for-service-stability: true
notify_discord:
needs: deploy
runs-on: ubuntu-latest
steps:
- name: Run Discord Webhook
uses: johnnyhuy/actions-discord-git-webhook@main
with:
webhook_url: ${{ secrets.DISCORD_WEBHOOK_URL }}

57
.github/workflows/version-bump.yml vendored Normal file
View File

@@ -0,0 +1,57 @@
name: Version Bump
on:
push:
branches: [ develop, main ]
jobs:
Build:
if: contains(github.event.head_commit.message, 'chore(release)') == false
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
token: ${{ secrets.CI_PAT_TOKEN }}
fetch-depth: 0
- name: Setup git config
run: |
git config --global user.name "standardci"
git config --global user.email "ci@standardnotes.com"
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v4
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- name: Install Dependencies
run: yarn install
- name: Get Changed Components Files
id: changed-component-files
uses: tj-actions/changed-files@v23
with:
files: packages/components/**
- name: Compile Components
if: steps.changed-component-files.outputs.any_changed == 'true'
run: yarn components:clean && yarn components:compile
working-directory: packages/components
- name: Package and Commit Components
if: steps.changed-component-files.outputs.any_changed == 'true'
run: |
node packages/components/scripts/package.mjs
git add .
(git commit -m 'chore(release): components') || true
- name: Bump Prod Version
if: ${{ github.ref == 'refs/heads/main' }}
run: yarn release:prod
- name: Bump Beta Version
if: ${{ github.ref == 'refs/heads/develop' }}
run: yarn release:beta

78
.github/workflows/web.release.beta.yml vendored Normal file
View File

@@ -0,0 +1,78 @@
name: Web Server Beta
on:
push:
branches: [ beta/* ]
paths:
- packages/web-server/**
- packages/web/**
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- name: Install dependencies
run: yarn install
- name: ESLint
run: yarn lint
- name: Build
run: yarn build:web-server
- name: Test
run: yarn test
deploy:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v2
- name: Copy robots.txt
run: cp public/robots.txt.development public/robots.txt
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: standardnotes/web
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tags: "beta,${{ github.sha }}"
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Download task definition
run: |
aws ecs describe-task-definition --task-definition app-beta-dev --query taskDefinition > task-definition.json
- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: task-definition.json
container-name: app-beta-dev
image: "standardnotes/web:${{ github.sha }}"
- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: app-beta-dev
cluster: dev
wait-for-service-stability: true
notify_discord:
needs: deploy
runs-on: ubuntu-latest
steps:
- name: Run Discord Webhook
uses: johnnyhuy/actions-discord-git-webhook@main
with:
webhook_url: ${{ secrets.DISCORD_WEBHOOK_URL }}

87
.github/workflows/web.release.dev.yml vendored Normal file
View File

@@ -0,0 +1,87 @@
name: Web Server Dev
concurrency:
group: dev_environment
cancel-in-progress: true
on:
push:
tags:
- '@standardnotes/web-server@[0-9]*.[0-9]*.[0-9]*-alpha.[0-9]*'
- '@standardnotes/web-server@[0-9]*.[0-9]*.[0-9]*-beta.[0-9]*'
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- name: Install dependencies
run: yarn install
- name: ESLint
run: yarn lint
- name: Build
run: yarn build:web-server
- name: Test
run: yarn test
deploy:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v2
- name: Copy robots.txt
run: cp packages/web-server/public/robots.txt.development packages/web-server/public/robots.txt
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: standardnotes/web
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tags: "latest,${{ github.sha }}"
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Download task definition
run: |
aws ecs describe-task-definition --task-definition app-dev --query taskDefinition > task-definition.json
- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: task-definition.json
container-name: app-dev
image: "standardnotes/web:${{ github.sha }}"
- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: app-dev
cluster: dev
wait-for-service-stability: true
notify_discord:
needs: deploy
runs-on: ubuntu-latest
steps:
- name: Run Discord Webhook
uses: johnnyhuy/actions-discord-git-webhook@main
with:
webhook_url: ${{ secrets.DISCORD_WEBHOOK_URL }}

84
.github/workflows/web.release.prod.yml vendored Normal file
View File

@@ -0,0 +1,84 @@
name: Web Server Prod
concurrency:
group: prod_environment
cancel-in-progress: true
on:
push:
tags:
- '@standardnotes/web-server@!(*alpha*|*beta*)'
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- name: Install dependencies
run: yarn install
- name: ESLint
run: yarn lint
- name: Build
run: yarn build:web-server
- name: Test
run: yarn test
deploy:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v2
- name: Copy robots.txt
run: cp packages/web-server/public/robots.txt.production packages/web-server/public/robots.txt
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: standardnotes/web
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tags: "stable,${{ github.sha }}"
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Download task definition
run: |
aws ecs describe-task-definition --task-definition app-prod --query taskDefinition > task-definition.json
- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: task-definition.json
container-name: app-prod
image: "standardnotes/web:${{ github.sha }}"
- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: app-prod
cluster: prod
wait-for-service-stability: true
notify_discord:
needs: deploy
runs-on: ubuntu-latest
steps:
- name: Run Discord Webhook
uses: johnnyhuy/actions-discord-git-webhook@main
with:
webhook_url: ${{ secrets.DISCORD_WEBHOOK_URL }}

53
.gitignore vendored
View File

@@ -1,54 +1,29 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'
.eslintcache
# OS & IDE
.DS_Store
.vscode
.idea
node_modules
# Ignore bundler config.
/.bundle
packages/web/dist
# Ignore all logfiles and tempfiles.
/log/*
!/log/.keep
/tmp
.sass-cache
/config/cap.yml
/app/assets/templates/generated/
/node_modules
/.sass-cache
# Ignore ENV variables config
.env
.ssh
dump.rdb
# Ignore compiled assets
/public/assets
# Ignore robots.txt - generated before image creation
/public/robots.txt
# Ignore user uploads
/public/uploads/*
!/public/uploads/.keep
.vscode
/dist
# Yarn
yarn-error.log
package-lock.json
codeqldb
coverage
lerna-debug.log
**/.pnp.*
**/.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
!.yarn/cache

1
.husky/.gitignore vendored
View File

@@ -1 +0,0 @@
_

4
.husky/commit-msg Executable file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
yarn commitlint --edit $1

View File

@@ -1,4 +1,2 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx lint-staged
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

View File

@@ -1,2 +1,3 @@
.github
codeqldb
CHANGELOG.md

1
.ruby-version Normal file
View File

@@ -0,0 +1 @@
2.7.4

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More