CD: prepare for tuono crate release

This commit is contained in:
Valerio Ageno
2024-05-25 11:29:11 +02:00
parent b91210084f
commit 89ffcf0923
23 changed files with 120 additions and 106 deletions
-36
View File
@@ -1,36 +0,0 @@
name: Publish package to npm
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- uses: pnpm/action-setup@v3
name: Install pnpm
with:
version: 8
run_install: false
- name: Install dependencies
run: pnpm install
- name: Install turbo
run: pnpm install turbo --global
- name: Build
run: pnpm build
- name: Publish
run: pnpm publish --no-git-checks --filter ./packages/tuono
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
+99
View File
@@ -0,0 +1,99 @@
name: Publish on npm and crates
on:
release:
types: [published]
jobs:
publish-on-npm-dry-run:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- uses: pnpm/action-setup@v3
name: Install pnpm
with:
version: 8
run_install: false
- name: Install dependencies
run: pnpm install
- name: Install turbo
run: pnpm install turbo --global
- name: Build
run: pnpm build
- name: Publish
run: pnpm publish --no-git-checks --dry-run --filter ./packages/tuono
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
publish-on-crates-dry-run:
name: Publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: katyo/publish-crates@v2
with:
dry-run: true
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
check-repo: true
publish-on-npm:
needs: [publish-on-crates-dry-run, publish-on-npm-dry-run]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- uses: pnpm/action-setup@v3
name: Install pnpm
with:
version: 8
run_install: false
- name: Install dependencies
run: pnpm install
- name: Install turbo
run: pnpm install turbo --global
- name: Build
run: pnpm build
- name: Publish
run: pnpm publish --no-git-checks --filter ./packages/tuono
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
publish-on-crates:
needs: [publish-on-crates-dry-run, publish-on-npm-dry-run]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: katyo/publish-crates@v2
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
check-repo: true
+1 -4
View File
@@ -1,11 +1,8 @@
[workspace]
resolver = "2"
members = [
"crates/cli",
"crates/axum_bundler",
"crates/bundler",
"crates/tuono",
"crates/tuono_lib",
"crates/tuono_lib_macros"
]
exclude = [
"examples/playground"
-13
View File
@@ -1,13 +0,0 @@
[package]
name = "axum_bundler"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
anyhow = "1.0.81"
glob = "0.3.1"
fastmurmur3 = "0.2.0"
-1
View File
@@ -1 +0,0 @@
# Axum bundler
-2
View File
@@ -1,2 +0,0 @@
mod bundle;
pub use bundle::bundle_axum_source;
-1
View File
@@ -1 +0,0 @@
# Tuono bundler
-2
View File
@@ -1,2 +0,0 @@
pub mod bundler;
-15
View File
@@ -1,15 +0,0 @@
[package]
name = "tuono"
version = "0.0.1"
edition = "2021"
authors = ["V. Ageno <valerioageno@yahoo.it>"]
[lib]
name = "tuono"
path = "src/lib.rs"
[dependencies]
clap = { version = "4.5.4", features = ["derive"] }
axum_bundler = { path = "../axum_bundler" }
tuono_bundler = { path = "../bundler"}
-11
View File
@@ -1,11 +0,0 @@
use axum_bundler::bundle_axum_source;
use std::process::Command;
pub fn run() {
// TODO: Pass "build" argument to update SSR path
bundle_axum_source();
println!("Build JS source");
let mut vite_build = Command::new("./node_modules/.bin/tuono-build-prod");
let _ = &vite_build.output().unwrap();
}
-4
View File
@@ -1,4 +0,0 @@
use bundler::bundler;
pub fn run() {
bundler::watch().unwrap();
}
-3
View File
@@ -1,3 +0,0 @@
pub mod build;
pub mod dev;
pub mod new;
-3
View File
@@ -1,3 +0,0 @@
pub fn run() {
println!("Scaffold new project");
}
@@ -1,18 +1,19 @@
[package]
name = "tuono_bundler"
name = "tuono"
version = "0.0.1"
edition = "2021"
authors = ["V. Ageno <valerioageno@yahoo.it>"]
[lib]
name = "bundler"
name = "tuono"
path = "src/lib.rs"
[dependencies]
clap = { version = "4.5.4", features = ["derive"] }
watchexec = "4.0.0"
miette = "7.2.0"
watchexec-signals = "3.0.0"
tokio = { version = "1", features = ["full"] }
watchexec-supervisor = "2.0.0"
glob = "0.3.1"
axum_bundler = { path = "../axum_bundler" }
@@ -1,6 +1,7 @@
use clap::{Parser, Subcommand};
pub mod actions;
use actions::{build, dev, new};
use std::process::Command;
mod axum_source_builder;
mod watch;
#[derive(Subcommand, Debug)]
enum Actions {
@@ -23,8 +24,16 @@ pub fn cli() {
let args = Args::parse();
match args.action.unwrap() {
Actions::Dev => dev::run(),
Actions::Build => build::run(),
Actions::New => new::run(),
Actions::Dev => watch::watch().unwrap(),
Actions::Build => {
axum_source_builder::bundle_axum_source();
println!("Build JS source");
let mut vite_build = Command::new("./node_modules/.bin/tuono-build-prod");
let _ = &vite_build.output().unwrap();
}
Actions::New => {
println!("Scaffold new project")
}
}
}
@@ -1,12 +1,13 @@
use std::sync::Arc;
use watchexec_supervisor::command::{Command, Program};
use axum_bundler::bundle_axum_source;
use miette::{IntoDiagnostic, Result};
use watchexec::Watchexec;
use watchexec_signals::Signal;
use watchexec_supervisor::job::start_job;
use crate::axum_source_builder::bundle_axum_source;
// What is the development pipeline?
//
// 1. Any file gets updates (rs/js/ts)
@@ -22,7 +23,6 @@ use watchexec_supervisor::job::start_job;
#[tokio::main]
pub async fn watch() -> Result<()> {
bundle_axum_source();
let (watch_client, _) = start_job(Arc::new(Command {
program: Program::Exec {
prog: "node_modules/.bin/tuono-dev-watch".into(),
-1
View File
@@ -1 +0,0 @@
# Tuonolib Macro