redesigned code editor #693
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build-deploy | |
on: | |
push: | |
paths-ignore: | |
- '*.md' | |
- 'docs/**' | |
pull_request: | |
paths-ignore: | |
- '*.md' | |
- 'docs/**' | |
jobs: | |
release-electron: | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
electron-arch-overrides: [''] | |
env: | |
USE_HARD_LINKS: false | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- run: echo ${{github.event_name}} | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '16.13.1' | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ./node_modules | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Make secrets.env.json | |
run: > | |
echo "{ | |
\"twitter\": { | |
\"api_key\": \"$TWITTER_API_KEY\", | |
\"api_secret_key\": \"$TWITTER_API_SECRET_KEY\", | |
\"bearer_token\": \"$TWITTER_BEARER_TOKEN\" | |
}, | |
\"reddit\": { | |
\"client_id\": \"$REDDIT_CLIENT_ID\" | |
}, | |
\"google\": { | |
\"client_id\": \"$GOOGLE_CLIENT_ID\", | |
\"client_secret\": \"$GOOGLE_CLIENT_SECRET\" | |
} | |
}" | |
> secrets.env.json | |
env: | |
TWITTER_API_KEY: ${{secrets.TWITTER_API_KEY}} | |
TWITTER_API_SECRET_KEY: ${{secrets.TWITTER_API_SECRET_KEY}} | |
TWITTER_BEARER_TOKEN: ${{secrets.TWITTER_BEARER_TOKEN}} | |
REDDIT_CLIENT_ID: ${{secrets.REDDIT_CLIENT_ID}} | |
GOOGLE_CLIENT_ID: ${{secrets.GOOGLE_CLIENT_ID}} | |
GOOGLE_CLIENT_SECRET: ${{secrets.GOOGLE_CLIENT_SECRET}} | |
- run: mkdir ./dgraph-download | |
# Gets releases from dgraph | |
- uses: robinraju/release-downloader@v1.3 | |
if: runner.os == 'Linux' | |
with: | |
repository: 'unigraph-dev/dgraph' | |
latest: true | |
fileName: 'dgraph_linux_amd64' | |
out-file-path: ./dgraph-download | |
- uses: robinraju/release-downloader@v1.3 | |
if: runner.os == 'Windows' | |
with: | |
repository: 'unigraph-dev/dgraph' | |
latest: true | |
fileName: 'dgraph_windows_amd64.exe' | |
out-file-path: ./dgraph-download | |
- uses: robinraju/release-downloader@v1.3 | |
if: runner.os == 'macOS' | |
with: | |
repository: 'unigraph-dev/dgraph' | |
latest: true | |
fileName: 'dgraph_darwin_amd64' | |
token: '${{secrets.PUBLIC_ACCESS_TOKEN}}' | |
out-file-path: ./dgraph-download | |
- uses: robinraju/release-downloader@v1.3 | |
if: runner.os == 'macOS' | |
with: | |
repository: 'unigraph-dev/dgraph' | |
latest: true | |
fileName: 'dgraph_darwin_arm64' | |
token: '${{secrets.PUBLIC_ACCESS_TOKEN}}' | |
out-file-path: ./dgraph-download | |
- run: mv ./dgraph-download/dgraph_linux_amd64 ./dgraph-download/dgraph | |
if: runner.os == 'Linux' | |
- run: mv ./dgraph-download/dgraph_darwin_amd64 ./dgraph-download/dgraph && mv ./dgraph-download/dgraph_darwin_arm64 ./dgraph-download/dgraph_arm64 | |
if: runner.os == 'macOS' | |
- run: mv ./dgraph-download/dgraph_windows_amd64.exe ./dgraph-download/dgraph.exe | |
if: runner.os == 'Windows' | |
- run: chmod +x ./dgraph-download/dgraph* | |
if: runner.os != 'Windows' | |
# Builds app | |
- run: yarn install --network-timeout 100000 | |
- run: yarn prepare-electron | |
- name: Prepare for app notarization | |
if: startsWith(matrix.os, 'macos') | |
# Import Apple API key for app notarization on macOS | |
run: | | |
mkdir -p ~/private_keys/ | |
echo '${{ secrets.mac_api_key }}' > ~/private_keys/AuthKey_${{ secrets.mac_api_key_id }}.p8 | |
- name: Build and Publish Electron App | |
uses: samuelmeuli/action-electron-builder@master | |
with: | |
# Don't run `yarn build`, which otherwise happens by default | |
skip_build: true | |
# GitHub token, automatically provided to the action | |
# (No need to define this secret in the repo settings) | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
release: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
package_root: 'packages/unigraph-dev-electron' | |
# macOS code signing certificate | |
mac_certs: ${{ secrets.mac_certs }} | |
mac_certs_password: ${{ secrets.mac_certs_password }} | |
args: ${{ matrix.electron-arch-overrides }} | |
env: | |
# macOS notarization API key | |
API_KEY_ID: ${{ secrets.mac_api_key_id }} | |
API_KEY_ISSUER_ID: ${{ secrets.mac_api_key_issuer_id }} |