From 59f6bf87d651d987be63941d42999ac205f891b2 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 23 Mar 2020 14:33:44 +0100 Subject: [PATCH] Fix release --- .github/workflows/release.yaml | 10 +++++++--- xtask/src/dist.rs | 11 ++++++++--- xtask/src/main.rs | 14 ++++++++++---- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index df34dfdb83..fb9e207b1d 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -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 diff --git a/xtask/src/dist.rs b/xtask/src/dist.rs index 2002d3e2aa..78dea08e7d 100644 --- a/xtask/src/dist.rs +++ b/xtask/src/dist.rs @@ -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) -> 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(()) diff --git a/xtask/src/main.rs b/xtask/src/main.rs index aafa736102..b1a56b67fc 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -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!(