mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
88 lines
2.7 KiB
YAML
88 lines
2.7 KiB
YAML
name: "Editor: Production (Latest Stable)"
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "latest-stable"
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
INDEX_HTML_HEAD_REPLACEMENT: <script defer data-domain="editor.graphite.rs" data-api="https://graphite.rs/visit/event" src="https://graphite.rs/visit/script.hash.js"></script>
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
deployments: write
|
|
|
|
steps:
|
|
- name: 📥 Clone and checkout repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: 📦 Install system dependencies
|
|
run: |
|
|
sudo apt update
|
|
sudo apt install libgtk-3-dev libsoup2.4-dev libjavascriptcoregtk-4.0-dev libwebkit2gtk-4.0-dev
|
|
|
|
- name: 🟢 Install the latest Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "latest"
|
|
|
|
- name: 🚧 Install Node dependencies
|
|
run: |
|
|
cd frontend
|
|
npm ci
|
|
|
|
- name: 🦀 Install the latest Rust
|
|
run: |
|
|
echo "Initial system version:"
|
|
rustc --version
|
|
rustup update stable
|
|
echo "Latest updated version:"
|
|
rustc --version
|
|
|
|
- name: 📜 Prepare to install Rust dependencies
|
|
uses: cargo-bins/cargo-binstall@main
|
|
|
|
- name: 📜 Install Rust dependencies
|
|
run: |
|
|
cargo binstall --no-confirm cargo-about
|
|
cargo binstall --no-confirm cargo-watch
|
|
cargo binstall --no-confirm wasm-pack
|
|
cargo binstall --no-confirm wasm-bindgen-cli@0.2.92
|
|
|
|
- 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: |
|
|
cd frontend
|
|
PATH=~/.cargo/bin:$PATH npm run build
|
|
|
|
- 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
|