Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ name: CI
jobs:
build:
name: Build
runs-on: '${{ matrix.os }}'
runs-on: "${{ matrix.os }}"
strategy:
matrix:
include:
- os: macos-latest
target: aarch64-apple-darwin
suffix: ''
suffix: ""
- os: macos-latest
target: x86_64-apple-darwin
suffix: ''
suffix: ""
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
suffix: ''
suffix: ""
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
suffix: ''
suffix: ""
- os: windows-latest
target: x86_64-pc-windows-msvc
suffix: .exe
Expand All @@ -51,7 +51,7 @@ jobs:
- name: Make binary executable
run: chmod u+x ./target/${{ matrix.target }}/release/tool-new-release${{ matrix.suffix }}
- name: Archive production artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: tool-new-release-${{ matrix.target }}
path: ./target/${{ matrix.target }}/release/tool-new-release${{ matrix.suffix }}
62 changes: 26 additions & 36 deletions src/args.rs
Original file line number Diff line number Diff line change
@@ -1,48 +1,38 @@
use clap:: {
Parser,
Subcommand
};
use clap::{Parser, Subcommand};

#[derive(Debug, Parser)]
#[clap(author, version, about)]
pub struct ReleaseArgs{
#[clap(subcommand)]
pub project: Project,

/// Run the deploy pipeline without actually deploying.
/// Useful for understanding all the necessary steps, or when working on the pipeline itself.
#[arg(long, global = true)]
pub dry_run: bool,
pub struct ReleaseArgs {
#[clap(subcommand)]
pub project: Project,

/// Run the deploy pipeline without actually deploying.
/// Useful for understanding all the necessary steps, or when working on the pipeline itself.
#[arg(long, global = true)]
pub dry_run: bool,
}

#[derive(Debug, Subcommand)]
pub enum Project {
/// Release the Guides guides.emberjs.com
Guides,

/// Run algolia on the guides
GuidesSearch,
/// Release the Guides guides.emberjs.com
Guides,

/// Release the API Docs api.emberjs.com
ApiDocs,
/// Run algolia on the guides
GuidesSearch,

/// Prepare the release blog post on blog.emberjs.com
BlogPost,
/// Release the API Docs api.emberjs.com
ApiDocs,

/// Update the Glitch project
Glitch {
/// Set this to be the version you're trying to release
#[arg(long)]
version: String,
},
/// Prepare the release blog post on blog.emberjs.com
BlogPost,

/// Update details on wikipedia
Wikipedia,
/// Update details on wikipedia
Wikipedia,

/// Update the reminder bot
Bot {
/// Set this to true if you're doing a major version release
#[arg(long, global = true)]
major_version: bool,
},
}
/// Update the reminder bot
Bot {
/// Set this to true if you're doing a major version release
#[arg(long, global = true)]
major_version: bool,
},
}
9 changes: 0 additions & 9 deletions src/git/add.rs

This file was deleted.

18 changes: 0 additions & 18 deletions src/git/commit.rs

This file was deleted.

11 changes: 0 additions & 11 deletions src/glitch/push.rs

This file was deleted.

31 changes: 16 additions & 15 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,30 +1,24 @@
use std::path::{PathBuf};
use crate::utils::prompt::{automated, yes_no};
use std::fs;
use dirs;
use std::fs;
use std::path::PathBuf;

mod projects {
pub mod api;
pub mod blog_post;
pub mod bot;
pub mod glitch;
pub mod guides;
pub mod wikipedia;
}
mod cli;
mod args;
mod cli;

use args::ReleaseArgs;
use clap::Parser;

pub mod utils;
mod git {
pub mod add;
pub mod clone;
pub mod commit;
pub mod push;
}
mod glitch {
pub mod push;
}

Expand All @@ -34,7 +28,6 @@ fn get_project_name(project: &args::Project) -> &'static str {
args::Project::GuidesSearch => "Guides",
args::Project::ApiDocs => "ApiDocs",
args::Project::BlogPost => "BlogPost",
args::Project::Glitch { version: _ } => "Glitch",
args::Project::Wikipedia => "Wikipedia",
args::Project::Bot { major_version: _ } => "Bot",
}
Expand All @@ -50,13 +43,22 @@ fn main() {
dir.push(get_project_name(&args.project));

let dir = dir.as_path();

let local_dir = format!("~/tool-new-release-working-dir/{}", get_project_name(&args.project));

let local_dir = format!(
"~/tool-new-release-working-dir/{}",
get_project_name(&args.project)
);

automated(format!("starting the process in the local dir {} now", local_dir).as_str());

if dir.exists() {
if yes_no(format!("Working directory {} already exists, do you want to delete it? y/n", local_dir).as_str()) {
if yes_no(
format!(
"Working directory {} already exists, do you want to delete it? y/n",
local_dir
)
.as_str(),
) {
println!("Deleting now!");
fs::remove_dir_all(dir).expect("could not delete working directory");
fs::create_dir_all(dir).expect("Could not create working directory");
Expand All @@ -70,11 +72,10 @@ fn main() {
args::Project::GuidesSearch => projects::guides::publish_algolia(dir, args.dry_run),
args::Project::ApiDocs => projects::api::run(dir, args.dry_run),
args::Project::BlogPost => projects::blog_post::run(),
args::Project::Glitch { version } => projects::glitch::run(dir, args.dry_run, version),
args::Project::Wikipedia => projects::wikipedia::run(),
args::Project::Bot { major_version } => {
let versions = crate::cli::ask_version(major_version);
projects::bot::run(&versions.target)
},
}
};
}
18 changes: 9 additions & 9 deletions src/projects/guides.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
use crate::utils::prompt::{automated, manual};
use std::{path::Path, process};
use semver::{Version, VersionReq};
use std::{path::Path, process};

pub fn run(dir: &Path, dry_run: bool) {
let npm_version_command = process::Command::new("node")
.arg("--version")
.output()
.expect("Could not check node version");
.arg("--version")
.output()
.expect("Could not check node version");

let stdout_result = String::from_utf8(npm_version_command.stdout).unwrap();

let req = VersionReq::parse(">=14.0.0").unwrap();

let version = Version::parse(&stdout_result[1..stdout_result.len()].trim()).unwrap();

if !req.matches(&version) {
panic!("Guides can only be installed with node version 14 and above right now. you have {:?}", stdout_result)
if !req.matches(&version) {
panic!(
"Guides can only be installed with node version 14 and above right now. you have {:?}",
stdout_result
)
}

manual("Check for pending PRs: https://github.com/ember-learn/guides-source/pulls");
Expand All @@ -35,7 +36,6 @@ pub fn run(dir: &Path, dry_run: bool) {
if !status.success() {
panic!("npm install failed");
}

}

automated("Creating new version of guides");
Expand Down
5 changes: 0 additions & 5 deletions src/utils/op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ pub fn read(path: &str) -> String {
let output = op().args(&["read", path]).output().unwrap();
String::from_utf8_lossy(&output.stdout).trim().to_string()
}
pub mod glitch {
pub fn read() -> String {
super::read("op://Ember Learning Team/Glitch/password")
}
}

pub mod api_docs {
use std::collections::HashMap;
Expand Down
Loading