Files
Graphite/.github/workflows/build-production.yml
Timon 5d22292072 Replace npm build script with new cargo run tool (#3832)
* move nix flake to root

* cargo run tool

* use thiserror in third-party-licenses tool

* prefere panic over exit

* Add automatic dependency check to cargo run tool

* Skip dependecies that are not needed for the current task

* Fixup

* Fixup

* fix windows

* Fixup

* improve usage text

* Fix linux bundle

* add graphen-cli

* fix build profile

* fix

* release profile should not include debug infos

* Review

* remove profiling profile

was redundent with release

* rename to cargo-run tool

* improve consistency

* rename deps to requirements

* fix

* return success when showing usage
2026-03-07 13:26:19 +00:00

78 lines
2.3 KiB
YAML

name: "Editor: Production (Latest Stable)"
on:
push:
tags:
- "latest-stable"
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: self-hosted
permissions:
contents: write
deployments: write
env:
RUSTC_WRAPPER: /usr/bin/sccache
CARGO_INCREMENTAL: 0
SCCACHE_DIR: /var/lib/github-actions/.cache
INDEX_HTML_HEAD_REPLACEMENT: <script defer data-domain="editor.graphite.art" data-api="https://graphite.art/visit/event" src="https://graphite.art/visit/script.hash.js"></script>
steps:
- name: 📥 Clone and checkout repository
uses: actions/checkout@v3
- name: 🗑 Clear wasm-bindgen cache
run: rm -r ~/.cache/.wasm-pack
- name: 🟢 Install the latest Node.js
uses: actions/setup-node@v4
with:
node-version: "latest"
- name: 🚧 Install build dependencies
run: |
cd frontend
npm run setup
- name: 🦀 Install the latest Rust
run: |
echo "Initial system version:"
rustc --version
rustup update stable
echo "Latest updated version:"
rustc --version
- name: ✂ Replace template in <head> of index.html
run: |
sed -i "s|<!-- INDEX_HTML_HEAD_REPLACEMENT -->|$INDEX_HTML_HEAD_REPLACEMENT|" frontend/index.html
- name: 🌐 Build Graphite web code
env:
NODE_ENV: production
run: mold -run cargo run build web
- name: 📤 Publish to Cloudflare Pages
id: cloudflare
uses: cloudflare/pages-action@1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
projectName: graphite-editor
directory: frontend/dist
branch: master
- name: 📦 Upload assets to GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
DATE=$(git log -1 --format=%cd --date=format:%Y-%m-%d)
cd frontend
sed -i "s|$INDEX_HTML_HEAD_REPLACEMENT||" dist/index.html
mv dist "graphite-$DATE"
zip -r "graphite-self-hosted-build.zip" "graphite-$DATE"
gh release upload latest-stable "graphite-self-hosted-build.zip" --clobber