Fix release

This commit is contained in:
Aleksey Kladov 2020-03-23 14:33:44 +01:00
parent f8fd242199
commit 59f6bf87d6
3 changed files with 25 additions and 10 deletions

View file

@ -49,11 +49,15 @@ jobs:
node-version: 12.x
- name: Dist
if: github.ref == 'refs/heads/release'
run: cargo xtask dist --version 0.2.$GITHUB_RUN_NUMBER --tag $(date --iso --utc)
if: matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/release'
run: cargo xtask dist --client --version 0.2.$GITHUB_RUN_NUMBER --tag $(date --iso --utc)
- name: Dist
if: github.ref != 'refs/heads/release'
if: matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/release'
run: cargo xtask dist --client --version 0.3.$GITHUB_RUN_NUMBER-nightly --tag nightly
- name: Dist
if: matrix.os != 'ubuntu-latest'
run: cargo xtask dist --version 0.3.$GITHUB_RUN_NUMBER-nightly --tag nightly
- name: Upload artifacts

View file

@ -7,13 +7,18 @@ use crate::{
project_root,
};
pub fn run_dist(version: &str, release_tag: &str) -> Result<()> {
pub struct ClientOpts {
pub version: String,
pub release_tag: String,
}
pub fn run_dist(client_opts: Option<ClientOpts>) -> Result<()> {
let dist = project_root().join("dist");
rm_rf(&dist)?;
fs2::create_dir_all(&dist)?;
if cfg!(target_os = "linux") {
dist_client(version, release_tag)?;
if let Some(ClientOpts { version, release_tag}) = client_opts {
dist_client(&version, &release_tag)?;
}
dist_server()?;
Ok(())

View file

@ -13,7 +13,7 @@ use std::env;
use pico_args::Arguments;
use xtask::{
codegen::{self, Mode},
dist::run_dist,
dist::{ClientOpts, run_dist},
install::{ClientOpt, InstallCmd, ServerOpt},
not_bash::pushd,
pre_commit, project_root, run_clippy, run_fuzzer, run_pre_cache, run_release, run_rustfmt,
@ -103,10 +103,16 @@ FLAGS:
run_release(dry_run)
}
"dist" => {
let version: String = args.value_from_str("--version")?;
let release_tag: String = args.value_from_str("--tag")?;
let client_opts = if args.contains("--client") {
Some(ClientOpts {
version: args.value_from_str("--version")?,
release_tag: args.value_from_str("--tag")?,
})
} else {
None
};
args.finish()?;
run_dist(&version, &release_tag)
run_dist(client_opts)
}
_ => {
eprintln!(