Skip to content

Commit e4251b2

Browse files
committed
Add auto deployment infrastructure for website
1 parent 0a7a69b commit e4251b2

File tree

7 files changed

+275
-182
lines changed

7 files changed

+275
-182
lines changed

.github/workflows/ci.yml

Lines changed: 120 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -1,125 +1,125 @@
1-
name: Continuous Integration
1+
name: "Editor: CI & Dev"
22

33
on:
4-
push:
5-
branches:
6-
- master
7-
pull_request:
8-
branches:
9-
- master
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
1010
env:
11-
CARGO_TERM_COLOR: always
12-
INDEX_HTML_HEAD_REPLACEMENT: <script defer data-domain="dev.graphite.rs" data-api="https://graphite.rs/visit/event" src="https://graphite.rs/visit/script.outbound-links.file-downloads.js"></script>
11+
CARGO_TERM_COLOR: always
12+
INDEX_HTML_HEAD_REPLACEMENT: <script defer data-domain="dev.graphite.rs" data-api="https://graphite.rs/visit/event" src="https://graphite.rs/visit/script.outbound-links.file-downloads.js"></script>
1313

1414
jobs:
15-
build:
16-
runs-on: self-hosted
17-
permissions:
18-
contents: read
19-
deployments: write
20-
pull-requests: write
21-
env:
22-
RUSTC_WRAPPER: /usr/bin/sccache
23-
CARGO_INCREMENTAL: 0
24-
SCCACHE_DIR: /var/lib/github-actions/.cache
25-
26-
steps:
27-
- uses: actions/checkout@v3
28-
29-
- name: 🔧 Clear wasm-bindgen cache
30-
run: rm -r ~/.cache/.wasm-pack
31-
32-
- name: 🔧 Set up Node
33-
uses: actions/setup-node@v3
34-
with:
35-
node-version: '16'
36-
37-
- name: 🚧 Install Node dependencies
38-
run: |
39-
cd frontend
40-
npm ci
41-
42-
- name: 🔼 Update Rust to latest stable
43-
run: |
44-
rustc --version
45-
rustup update stable
46-
rustc --version
47-
48-
- name: Replace template in <head> of index.html
49-
run: |
50-
# Remove the INDEX_HTML_HEAD_REPLACEMENT environment variable for build links (not master deploys)
51-
git rev-parse --abbrev-ref HEAD | grep master > /dev/null || export INDEX_HTML_HEAD_REPLACEMENT=""
52-
sed -i "s|<!-- INDEX_HTML_HEAD_REPLACEMENT -->|$INDEX_HTML_HEAD_REPLACEMENT|" frontend/index.html
53-
54-
- name: 🌐 Build Graphite web code
55-
env:
56-
NODE_ENV: production
57-
run: |
58-
cd frontend
59-
mold -run npm run build
60-
61-
- name: Publish
62-
id: cloudflare
63-
uses: cloudflare/pages-action@1
64-
continue-on-error: true
65-
with:
66-
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
67-
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
68-
projectName: graphite-dev
69-
directory: frontend/dist
70-
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
71-
72-
- name: 👕 Lint Graphite web formatting
73-
env:
74-
NODE_ENV: production
75-
run: |
76-
cd frontend
77-
# npm run lint
78-
echo "💥 Frontend linting is temporarily disabled until it can be set up again with Svelte 💥"
79-
80-
- name: 🔬 Check Rust formatting
81-
run: |
82-
mold -run cargo fmt --all -- --check
83-
84-
- name: 🦀 Build Rust code
85-
run: |
86-
mold -run cargo build
87-
88-
- name: 🧪 Run Rust tests
89-
run: |
90-
mold -run cargo nextest run
91-
92-
#miri:
93-
# runs-on: self-hosted
94-
#
95-
# steps:
96-
# - uses: actions/checkout@v3
97-
#
98-
# - name: 🧪 Run Rust miri
99-
# run: |
100-
# mold -run cargo +nightly miri nextest run -j32
101-
102-
cargo-deny:
103-
runs-on: ubuntu-latest
104-
105-
strategy:
106-
matrix:
107-
checks:
108-
- 'crate security advisories'
109-
- 'crate license compatibility'
110-
111-
# Prevent sudden announcement of a new advisory from failing ci:
112-
continue-on-error: ${{ matrix.checks == 'crate security advisories' }}
113-
114-
steps:
115-
- uses: actions/checkout@v3
116-
117-
- uses: EmbarkStudios/cargo-deny-action@v1
118-
if: matrix.checks == 'crate security advisories'
119-
with:
120-
command: check advisories
121-
122-
- uses: EmbarkStudios/cargo-deny-action@v1
123-
if: matrix.checks == 'crate license compatibility'
124-
with:
125-
command: check bans licenses sources
15+
build:
16+
runs-on: self-hosted
17+
permissions:
18+
contents: read
19+
deployments: write
20+
pull-requests: write
21+
env:
22+
RUSTC_WRAPPER: /usr/bin/sccache
23+
CARGO_INCREMENTAL: 0
24+
SCCACHE_DIR: /var/lib/github-actions/.cache
25+
26+
steps:
27+
- uses: actions/checkout@v3
28+
29+
- name: 🔧 Clear wasm-bindgen cache
30+
run: rm -r ~/.cache/.wasm-pack
31+
32+
- name: 🔧 Set up Node
33+
uses: actions/setup-node@v3
34+
with:
35+
node-version: "16"
36+
37+
- name: 🚧 Install Node dependencies
38+
run: |
39+
cd frontend
40+
npm ci
41+
42+
- name: 🔼 Update Rust to latest stable
43+
run: |
44+
rustc --version
45+
rustup update stable
46+
rustc --version
47+
48+
- name: Replace template in <head> of index.html
49+
run: |
50+
# Remove the INDEX_HTML_HEAD_REPLACEMENT environment variable for build links (not master deploys)
51+
git rev-parse --abbrev-ref HEAD | grep master > /dev/null || export INDEX_HTML_HEAD_REPLACEMENT=""
52+
sed -i "s|<!-- INDEX_HTML_HEAD_REPLACEMENT -->|$INDEX_HTML_HEAD_REPLACEMENT|" frontend/index.html
53+
54+
- name: 🌐 Build Graphite web code
55+
env:
56+
NODE_ENV: production
57+
run: |
58+
cd frontend
59+
mold -run npm run build
60+
61+
- name: Publish
62+
id: cloudflare
63+
uses: cloudflare/pages-action@1
64+
continue-on-error: true
65+
with:
66+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
67+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
68+
projectName: graphite-dev
69+
directory: frontend/dist
70+
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
71+
72+
- name: 👕 Lint Graphite web formatting
73+
env:
74+
NODE_ENV: production
75+
run: |
76+
cd frontend
77+
# npm run lint
78+
echo "💥 Frontend linting is temporarily disabled until it can be set up again with Svelte 💥"
79+
80+
- name: 🔬 Check Rust formatting
81+
run: |
82+
mold -run cargo fmt --all -- --check
83+
84+
- name: 🦀 Build Rust code
85+
run: |
86+
mold -run cargo build
87+
88+
- name: 🧪 Run Rust tests
89+
run: |
90+
mold -run cargo nextest run
91+
92+
#miri:
93+
# runs-on: self-hosted
94+
#
95+
# steps:
96+
# - uses: actions/checkout@v3
97+
#
98+
# - name: 🧪 Run Rust miri
99+
# run: |
100+
# mold -run cargo +nightly miri nextest run -j32
101+
102+
cargo-deny:
103+
runs-on: ubuntu-latest
104+
105+
strategy:
106+
matrix:
107+
checks:
108+
- "crate security advisories"
109+
- "crate license compatibility"
110+
111+
# Prevent sudden announcement of a new advisory from failing ci:
112+
continue-on-error: ${{ matrix.checks == 'crate security advisories' }}
113+
114+
steps:
115+
- uses: actions/checkout@v3
116+
117+
- uses: EmbarkStudios/cargo-deny-action@v1
118+
if: matrix.checks == 'crate security advisories'
119+
with:
120+
command: check advisories
121+
122+
- uses: EmbarkStudios/cargo-deny-action@v1
123+
if: matrix.checks == 'crate license compatibility'
124+
with:
125+
command: check bans licenses sources

.github/workflows/deploy.yml

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,65 @@
1-
name: Deploy release
1+
name: "Editor: Production (Latest Stable)"
22

33
on:
4-
push:
5-
tags:
6-
- 'latest-stable'
4+
push:
5+
tags:
6+
- "latest-stable"
77

88
env:
9-
CARGO_TERM_COLOR: always
9+
CARGO_TERM_COLOR: always
1010

1111
jobs:
12-
build:
13-
runs-on: self-hosted
14-
permissions:
15-
contents: read
16-
deployments: write
17-
env:
18-
RUSTC_WRAPPER: /usr/bin/sccache
19-
CARGO_INCREMENTAL: 0
20-
SCCACHE_DIR: /var/lib/github-actions/.cache
21-
INDEX_HTML_HEAD_REPLACEMENT: <script defer data-domain="editor.graphite.rs" data-api="https://graphite.rs/visit/event" src="https://graphite.rs/visit/script.outbound-links.file-downloads.js"></script>
12+
build:
13+
runs-on: self-hosted
14+
permissions:
15+
contents: read
16+
deployments: write
17+
env:
18+
RUSTC_WRAPPER: /usr/bin/sccache
19+
CARGO_INCREMENTAL: 0
20+
SCCACHE_DIR: /var/lib/github-actions/.cache
21+
INDEX_HTML_HEAD_REPLACEMENT: <script defer data-domain="editor.graphite.rs" data-api="https://graphite.rs/visit/event" src="https://graphite.rs/visit/script.outbound-links.file-downloads.js"></script>
2222

23-
steps:
24-
- uses: actions/checkout@v3
23+
steps:
24+
- uses: actions/checkout@v3
2525

26-
- name: 🔧 Clear wasm-bindgen cache
27-
run: rm -r ~/.cache/.wasm-pack
26+
- name: 🔧 Clear wasm-bindgen cache
27+
run: rm -r ~/.cache/.wasm-pack
2828

29-
- name: 🔧 Set up Node
30-
uses: actions/setup-node@v3
31-
with:
32-
node-version: '16'
29+
- name: 🔧 Set up Node
30+
uses: actions/setup-node@v3
31+
with:
32+
node-version: "16"
3333

34-
- name: 🚧 Install Node dependencies
35-
run: |
36-
cd frontend
37-
npm ci
34+
- name: 🚧 Install Node dependencies
35+
run: |
36+
cd frontend
37+
npm ci
3838
39-
- name: 🔼 Update Rust to latest stable
40-
run: |
41-
rustc --version
42-
rustup update stable
43-
rustc --version
39+
- name: 🔼 Update Rust to latest stable
40+
run: |
41+
rustc --version
42+
rustup update stable
43+
rustc --version
4444
45-
- name: Replace template in <head> of index.html
46-
run: |
47-
sed -i "s|<!-- INDEX_HTML_HEAD_REPLACEMENT -->|$INDEX_HTML_HEAD_REPLACEMENT|" frontend/index.html
45+
- name: Replace template in <head> of index.html
46+
run: |
47+
sed -i "s|<!-- INDEX_HTML_HEAD_REPLACEMENT -->|$INDEX_HTML_HEAD_REPLACEMENT|" frontend/index.html
4848
49-
- name: 🌐 Build Graphite web code
50-
env:
51-
NODE_ENV: production
52-
run: |
53-
cd frontend
54-
mold -run npm run build
49+
- name: 🌐 Build Graphite web code
50+
env:
51+
NODE_ENV: production
52+
run: |
53+
cd frontend
54+
mold -run npm run build
5555
56-
- name: Publish
57-
id: cloudflare
58-
uses: cloudflare/pages-action@1
59-
with:
60-
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
61-
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
62-
projectName: graphite-editor
63-
directory: frontend/dist
64-
branch: master
65-
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
56+
- name: Publish
57+
id: cloudflare
58+
uses: cloudflare/pages-action@1
59+
with:
60+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
61+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
62+
projectName: graphite-editor
63+
directory: frontend/dist
64+
branch: master
65+
gitHubToken: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)