Skip to content
This repository was archived by the owner on Mar 25, 2023. It is now read-only.

Commit b63aff8

Browse files
Merge pull request #14 from splitgraph/next
First release to master
2 parents 41ddb5d + 3e86546 commit b63aff8

File tree

510 files changed

+70033
-2501
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

510 files changed

+70033
-2501
lines changed

.ci/after_success.sh

Lines changed: 0 additions & 13 deletions
This file was deleted.

.ci/build.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
3+
CI_DIR="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
4+
SPLITGRAPH_DIR="$CI_DIR/.."
5+
6+
pushd "$SPLITGRAPH_DIR" \
7+
&& yarn build \
8+
&& echo "Build successful" \
9+
&& exit 0
10+
11+
exit 1

.ci/deploy_preview.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
3+
CI_DIR="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
4+
SPLITGRAPH_DIR="$CI_DIR/.."
5+
6+
COMMITISH="$(git rev-parse HEAD | cut -c -8)"
7+
COMMIT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
8+
9+
# We don't want google indexing the preview website(s)
10+
# Inject robots.txt here instead of at build step, because this is only for preview
11+
inject_robots_txt() {
12+
cat <<EOF > "${SPLITGRAPH_DIR}/docs/out/robots.txt" && return 0
13+
User-agent: *
14+
Disallow: /
15+
EOF
16+
return 1
17+
}
18+
19+
pushd "$SPLITGRAPH_DIR" \
20+
&& inject_robots_txt \
21+
&& echo "Deploy preview: $COMMITISH ($COMMIT_BRANCH)" \
22+
&& yarn deploy \
23+
$( test ! -z $NOW_TOKEN && echo "--token $NOW_TOKEN" ) \
24+
--force \
25+
-m COMMITISH="$COMMITISH" \
26+
-m COMMIT_BRANCH="$COMMIT_BRANCH" \
27+
&& echo "Deployment successful" \
28+
&& echo "Deployment URL: $("$CI_DIR"/get_preview_url.sh)" \
29+
&& echo \
30+
&& exit 0
31+
32+
exit 1

.ci/get_preview_url.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env bash
2+
3+
# Get the preview URL for the latest deployment with this commitish as metadata
4+
# Print the preview URL to stdout for capture, and also to stderr for debugging
5+
#
6+
# Usage example to capture to stdout:
7+
# preview_url="$(./.ci/get_preview_url.sh)"
8+
#
9+
# or, to save to file `preview_url.txt`:
10+
# ./.ci/get_preview_url.sh preview_url.txt
11+
#
12+
# or, to save to file `preview_url.txt` using commitish `f8f3f20e`
13+
# ./ci/get_preview_url.sh preview_url.txt f8f3f20e
14+
#
15+
# or, to save to no file (/dev/null) using commitish `f8f3f20e`
16+
# ./ci/get_preview_url.sh /dev/null f8f3f20e
17+
#
18+
19+
CI_DIR="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
20+
SPLITGRAPH_DIR="$CI_DIR/.."
21+
22+
OUTPUT_FILE="${1-/dev/null}"
23+
COMMITISH=${2-"$(git rev-parse HEAD | cut -c -8)"}
24+
25+
cd "$SPLITGRAPH_DIR" \
26+
&& >&2 echo -n "Getting preview URL for $COMMITISH (write to $OUTPUT_FILE)... " \
27+
&& ( yarn run deploy ls splitgraph-web \
28+
-m COMMITISH="$COMMITISH" \
29+
2> /dev/null \
30+
| grep splitgraph-web \
31+
| awk '{print $2}' \
32+
| head -n1 \
33+
| tr -d '\n' \
34+
| awk '{print;print > "/dev/stderr"}' \
35+
| tee "$OUTPUT_FILE" ) \
36+
&& exit 0
37+
38+
>&2 echo "Fatal Error: Could not get preview URL"
39+
exit 1

.ci/install.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
3+
CI_DIR="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
4+
SPLITGRAPH_DIR="$CI_DIR/.."
5+
6+
if test ! -z "$YARN_CACHE_FOLDER" ; then
7+
8+
if git log --format=%B HEAD -n1 | grep -q '[clear cache]' ; then
9+
>&2 echo "Clear cache ${YARN_CACHE_FOLDER}..."
10+
test -d "$YARN_CACHE_FOLDER" && rm -r "$YARN_CACHE_FOLDER"
11+
fi
12+
13+
mkdir -p "$YARN_CACHE_FOLDER"
14+
echo "Yarn cache ($YARN_CACHE_FOLDER): $(ls -l "$YARN_CACHE_FOLDER" | wc -l)"
15+
fi
16+
17+
pushd "$SPLITGRAPH_DIR" \
18+
&& ./setup.sh \
19+
&& yarn install --immutable \
20+
&& echo "Installed successfully" \
21+
&& (
22+
test ! -z "$YARN_CACHE_FOLDER" \
23+
&& echo "Yarn cache ($YARN_CACHE_FOLDER): $(ls -l "$YARN_CACHE_FOLDER" | wc -l)" \
24+
|| true
25+
) && exit 0
26+
27+
exit 1

.ci/remote_deploy.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.

.ci/script.sh

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Build and deploy preview
2+
3+
on: push
4+
5+
jobs:
6+
build_and_deploy_preview:
7+
runs-on: ubuntu-latest
8+
if: "!contains(github.event.head_commit.message, '[skip ci]')"
9+
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Use Node.js
13+
uses: actions/setup-node@v1
14+
with:
15+
node-version: 13.x
16+
- run: ./setup.sh
17+
- uses: actions/cache@v1
18+
with:
19+
path: /home/runner/yarn-cache
20+
key: yarncache
21+
- run: ./.ci/install.sh
22+
env:
23+
YARN_CACHE_FOLDER: /home/runner/yarn-cache
24+
- run: ./.ci/build.sh
25+
- run: ./.ci/deploy_preview.sh
26+
env:
27+
NOW_TOKEN: ${{ secrets.NOW_TOKEN }}
28+
NOW_PROJECT_ID: ${{ secrets.NOW_PROJECT_ID }}
29+
NOW_ORG_ID: ${{ secrets.NOW_ORG_ID }}
30+
- uses: actions/upload-artifact@v2
31+
with:
32+
name: website
33+
path: ./docs/out
34+
- run: ./.ci/get_preview_url.sh preview_url.txt
35+
- run: cat preview_url.txt
36+
- uses: actions/upload-artifact@v2
37+
with:
38+
name: preview_url.txt
39+
path: preview_url.txt
40+
41+
release_master:
42+
runs-on: ubuntu-latest
43+
needs: build_and_deploy_preview
44+
if: github.ref == 'refs/heads/master'
45+
steps:
46+
- name: Download artifact
47+
uses: actions/download-artifact@v2
48+
with:
49+
name: website
50+
path: website
51+
- name: List artifact
52+
run: ls -R website
53+
- name: Remove preview artifacts (robots.txt)
54+
run: rm website/robots.txt
55+
- name: Create release tarball
56+
run: tar -cz -f /home/runner/release.tar.gz -C /home/runner/work/splitgraph.com/splitgraph.com/website .
57+
- name: Get current date
58+
id: date
59+
run: echo "::set-output name=date::$(date +'%Y-%m-%d-%H%M')"
60+
- name: Create Release
61+
id: create_release
62+
uses: actions/create-release@v1
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
with:
66+
tag_name: ${{steps.date.outputs.date}}.${{ github.run_id }}
67+
release_name: Release ${{steps.date.outputs.date}}.${{ github.run_id }}
68+
draft: false
69+
prerelease: false
70+
- name: Upload Release Asset
71+
id: upload-release-asset
72+
uses: actions/upload-release-asset@v1
73+
env:
74+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75+
with:
76+
upload_url: ${{ steps.create_release.outputs.upload_url }}
77+
asset_path: /home/runner/release.tar.gz
78+
asset_name: website.tar.gz
79+
asset_content_type: application/gzip

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
.DS_Store
22

3+
preview_url.txt
4+
35
node_modules
46

57
lib/core/metadata.js
@@ -10,3 +12,17 @@ website/build/
1012
website/yarn.lock
1113
website/node_modules
1214
website/i18n/*
15+
16+
.next
17+
.cache
18+
yarn-error.log
19+
20+
# Temporary experiment, don't check in
21+
libmdx
22+
23+
# TODO: This is a bit crude, but suits our purposes for now while everything
24+
# is in docker upstream of this repository
25+
*/**/build-state.yml
26+
*/**/yarn-rc.js
27+
.yarnrc.yml
28+
.yarn

.travis.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)