Skip to content

Commit 19dd4cc

Browse files
committed
Add: Update dist to latest.
Switch to a use dist workspace instead of manual edits to release.yml. Change builder to run from any directory.
1 parent 69ed501 commit 19dd4cc

File tree

7 files changed

+53
-16
lines changed

7 files changed

+53
-16
lines changed

.github/workflows/release.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ jobs:
7777
# but also really annoying to build CI around when it needs secrets to work right.)
7878
- id: plan
7979
run: |
80-
cd server
8180
dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json
8281
echo "dist ran successfully"
8382
cat plan-dist-manifest.json
@@ -86,7 +85,7 @@ jobs:
8685
uses: actions/upload-artifact@v4
8786
with:
8887
name: artifacts-plan-dist-manifest
89-
path: server/plan-dist-manifest.json
88+
path: plan-dist-manifest.json
9089

9190
# Build and packages all the platform-specific things
9291
build-local-artifacts:
@@ -145,11 +144,10 @@ jobs:
145144
${{ matrix.packages_install }}
146145
- name: Build artifacts
147146
run: |
148-
cd server
149-
./bt prerelease
147+
builder/bt prerelease
150148
# Actually do builds and make zips and whatnot
151149
dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
152-
./bt postrelease ${{ matrix.dist_args }}
150+
builder/bt postrelease ${{ matrix.dist_args }}
153151
echo "dist ran successfully"
154152
- id: cargo-dist
155153
name: Post-build
@@ -158,7 +156,6 @@ jobs:
158156
# inconsistent syntax between shell and powershell.
159157
shell: bash
160158
run: |
161-
cd server
162159
# Parse out what we just built and upload it to scratch storage
163160
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
164161
dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT"
@@ -201,7 +198,7 @@ jobs:
201198
uses: actions/download-artifact@v4
202199
with:
203200
pattern: artifacts-*
204-
path: server/target/distrib/
201+
path: target/distrib/
205202
merge-multiple: true
206203
- id: cargo-dist
207204
shell: bash
@@ -256,12 +253,11 @@ jobs:
256253
uses: actions/download-artifact@v4
257254
with:
258255
pattern: artifacts-*
259-
path: server/target/distrib/
256+
path: target/distrib/
260257
merge-multiple: true
261258
- id: host
262259
shell: bash
263260
run: |
264-
cd server
265261
dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json
266262
echo "artifacts uploaded and released successfully"
267263
cat dist-manifest.json
@@ -271,7 +267,7 @@ jobs:
271267
with:
272268
# Overwrite the previous copy
273269
name: artifacts-dist-manifest
274-
path: server/dist-manifest.json
270+
path: dist-manifest.json
275271
# Create a GitHub Release while uploading all files to it
276272
- name: "Download GitHub Artifacts"
277273
uses: actions/download-artifact@v4

builder/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@ edition = "2024"
2727
clap = { version = "4.5.19", features = ["derive"] }
2828
cmd_lib = "1.9.5"
2929
current_platform = "0.2.0"
30+
dunce = "1.0.5"
3031
path-slash = "0.2.1"
3132
regex = "1.11.1"

builder/src/main.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
//
3333
// ### Standard library
3434
use std::{
35+
env,
3536
ffi::OsStr,
3637
fs, io,
3738
path::{Path, PathBuf},
@@ -42,6 +43,7 @@ use std::{
4243
use clap::{Parser, Subcommand};
4344
use cmd_lib::run_cmd;
4445
use current_platform::CURRENT_PLATFORM;
46+
use dunce::canonicalize;
4547
use path_slash::PathBufExt;
4648
use regex::Regex;
4749

@@ -575,6 +577,13 @@ impl Cli {
575577
}
576578

577579
fn main() -> io::Result<()> {
580+
// Change to the `server/` directory, so it can be run from anywhere.
581+
let mut root_path = PathBuf::from(env::current_exe().unwrap().parent().unwrap());
582+
root_path.push("../../../server");
583+
// Use `dunce.canonicalize`, since UNC paths booger up some of the build tools (cargo can't delete the builder's binary, NPM doesn't accept UNC paths.)
584+
root_path = canonicalize(root_path).unwrap();
585+
env::set_current_dir(root_path).unwrap();
586+
578587
let cli = Cli::parse();
579588
cli.run()?;
580589

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,17 @@
2020
# [cargo-dist](https://opensource.axo.dev/cargo-dist/)
2121
# ====================================================
2222
[workspace]
23-
members = ["cargo:."]
23+
members = ["cargo:server/"]
2424

2525
# Config for 'dist'
2626
[dist]
2727
# The preferred dist version to use in CI (Cargo.toml SemVer syntax)
2828
cargo-dist-version = "0.29.0"
29-
# Extra static files to include in each App (path relative to this Cargo.toml's dir)
30-
include = ["log4rs.yml", "hashLocations.json", "../client/static"]
29+
# CI backends to support
30+
ci = "github"
3131
# The installers to generate for each app
3232
installers = []
3333
# Target platforms to build apps for (Rust target-triple syntax)
3434
targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc"]
35-
# CI backends to support
36-
ci = "github"
3735
# Skip checking whether the specified configuration files are up to date
3836
allow-dirty = ["ci"]

server/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ authors = ["Bryan A. Jones", "Peter Loux"]
2626
categories = ["development-tools", "text-editors"]
2727
description = "A programmer's word processor."
2828
edition = "2024"
29+
homepage = "https://codechat-editor.onrender.com"
2930
keywords = ["literate programming"]
3031
license = "GPL-3.0-only"
3132
name = "codechat-editor-server"

server/bt.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@
1919
# # `bt` -- Shortcut to run the CodeChat Editor build tool
2020

2121
# See [passing all command-line arguments](https://www.scivision.dev/powershell-pass-all-command-args/).
22-
cargo run --manifest-path=../builder/Cargo.toml -- $args
22+
$manifest_path = Join-Path -Path $PSScriptRoot -ChildPath ../builder/Cargo.toml
23+
echo $manifest_path
24+
cargo run --manifest-path=$manifest_path -- $args

server/dist.toml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright (C) 2025 Bryan A. Jones.
2+
#
3+
# This file is part of the CodeChat Editor.
4+
#
5+
# The CodeChat Editor is free software: you can redistribute it and/or modify it
6+
# under the terms of the GNU General Public License as published by the Free
7+
# Software Foundation, either version 3 of the License, or (at your option) any
8+
# later version.
9+
#
10+
# The CodeChat Editor is distributed in the hope that it will be useful, but
11+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13+
# details.
14+
#
15+
# You should have received a copy of the GNU General Public License along with
16+
# the CodeChat Editor. If not, see
17+
# [http://www.gnu.org/licenses/](http://www.gnu.org/licenses/).
18+
#
19+
# `dist.toml` - Configure
20+
# [cargo-dist](https://opensource.axo.dev/cargo-dist/)
21+
# ====================================================
22+
# Config for 'dist'
23+
[dist]
24+
# Extra static files to include in each App (path relative to this Cargo.toml's dir)
25+
include = ["log4rs.yml", "hashLocations.json", "../client/static"]
26+
27+
[package]
28+
# These files are relative to the root `dist-workspace.toml`, not to this file.
29+
changelog = "docs/changelog.md"
30+
license-files = ["LICENSE.md"]

0 commit comments

Comments
 (0)