Remove v
prefix from version (#850)
This commit is contained in:
parent
acc7494268
commit
0a9ffd7a7b
27
.github/workflows/build.yaml
vendored
27
.github/workflows/build.yaml
vendored
@ -69,25 +69,26 @@ jobs:
|
||||
run: |
|
||||
sudo apt-get update
|
||||
|
||||
- name: Install Main Toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
target: ${{ matrix.target }}
|
||||
profile: minimal
|
||||
components: clippy
|
||||
override: true
|
||||
- name: Install Rust Toolchain
|
||||
run: |
|
||||
rustup component add clippy
|
||||
rustup target add ${{ matrix.target }}
|
||||
rustup default `cat rust-toolchain`-${{ matrix.target }}
|
||||
|
||||
- name: Install AArch64 Toolchain
|
||||
if: matrix.target == 'aarch64-unknown-linux-gnu'
|
||||
run: sudo apt-get install gcc-aarch64-linux-gnu
|
||||
|
||||
- name: Version
|
||||
- name: Info
|
||||
run: |
|
||||
rustup --version
|
||||
cargo --version
|
||||
cargo clippy --version
|
||||
|
||||
- name: Check Lockfile
|
||||
run: |
|
||||
cargo update --locked --package just
|
||||
|
||||
- name: Build
|
||||
run: cargo build --all --target ${{ matrix.target }}
|
||||
|
||||
@ -144,12 +145,16 @@ jobs:
|
||||
run: ./bin/package ${{github.ref}} ${{matrix.os}} ${{ matrix.target }}
|
||||
shell: bash
|
||||
|
||||
- name: Prerelease Check
|
||||
id: is_prerelease
|
||||
run: cargo run --package prerelease -- --reference ${{ github.ref }}
|
||||
|
||||
- name: Publish
|
||||
uses: softprops/action-gh-release@v1
|
||||
uses: softprops/action-gh-release@v0.1.5
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
draft: false
|
||||
files: ${{ steps.package.outputs.archive }}
|
||||
prerelease: ${{ ! startsWith(github.ref, 'refs/tags/v') }}
|
||||
prerelease: ${{ steps.is_prerelease.outputs.value }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
64
Cargo.lock
generated
64
Cargo.lock
generated
@ -266,6 +266,15 @@ version = "0.2.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
|
||||
|
||||
[[package]]
|
||||
name = "prerelease"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"executable-path",
|
||||
"regex",
|
||||
"structopt",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pretty_assertions"
|
||||
version = "0.7.2"
|
||||
@ -278,6 +287,30 @@ dependencies = [
|
||||
"output_vt100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-error"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
|
||||
dependencies = [
|
||||
"proc-macro-error-attr",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-error-attr"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.27"
|
||||
@ -398,6 +431,30 @@ version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
|
||||
|
||||
[[package]]
|
||||
name = "structopt"
|
||||
version = "0.3.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5277acd7ee46e63e5168a80734c9f6ee81b1367a7d8772a2d765df2a3705d28c"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"lazy_static",
|
||||
"structopt-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "structopt-derive"
|
||||
version = "0.4.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ba9cdfda491b814720b6b06e0cac513d922fc407582032e8706e9f137976f90"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strum"
|
||||
version = "0.20.0"
|
||||
@ -463,6 +520,7 @@ dependencies = [
|
||||
name = "test-utilities"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"just",
|
||||
"tempfile",
|
||||
]
|
||||
|
||||
@ -499,6 +557,12 @@ version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.10.2+wasi-snapshot-preview1"
|
||||
|
@ -12,6 +12,9 @@ autotests = false
|
||||
categories = ["command-line-utilities", "development-tools"]
|
||||
keywords = ["command-line", "task", "runner", "development", "utility"]
|
||||
|
||||
[workspace]
|
||||
members = [".", "bin/prerelease"]
|
||||
|
||||
[dependencies]
|
||||
ansi_term = "0.12.0"
|
||||
atty = "0.2.0"
|
||||
|
13
bin/prerelease/Cargo.toml
Normal file
13
bin/prerelease/Cargo.toml
Normal file
@ -0,0 +1,13 @@
|
||||
[package]
|
||||
name = "prerelease"
|
||||
version = "0.0.0"
|
||||
authors = ["Casey Rodarmor <casey@rodarmor.com>"]
|
||||
edition = "2018"
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
regex = "1.5.4"
|
||||
structopt = "0.3.21"
|
||||
|
||||
[dev-dependencies]
|
||||
executable-path = "1.0.0"
|
20
bin/prerelease/src/main.rs
Normal file
20
bin/prerelease/src/main.rs
Normal file
@ -0,0 +1,20 @@
|
||||
use regex::Regex;
|
||||
use structopt::StructOpt;
|
||||
|
||||
#[derive(StructOpt)]
|
||||
struct Arguments {
|
||||
#[structopt(long)]
|
||||
reference: String,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let arguments = Arguments::from_args();
|
||||
|
||||
let regex = Regex::new("^refs/tags/[[:digit:]]+[.][[:digit:]]+[.][[:digit:]]+$")
|
||||
.expect("Failed to compile release regex");
|
||||
|
||||
println!(
|
||||
"::set-output name=value::{}",
|
||||
!regex.is_match(&arguments.reference)
|
||||
);
|
||||
}
|
42
bin/prerelease/tests/integration.rs
Normal file
42
bin/prerelease/tests/integration.rs
Normal file
@ -0,0 +1,42 @@
|
||||
use executable_path::executable_path;
|
||||
use std::{process::Command, str};
|
||||
|
||||
fn stdout(reference: &str) -> String {
|
||||
let output = Command::new(executable_path("prerelease"))
|
||||
.args(&["--reference", reference])
|
||||
.output()
|
||||
.unwrap();
|
||||
|
||||
assert!(output.status.success());
|
||||
|
||||
String::from_utf8(output.stdout).unwrap()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn junk_is_prerelease() {
|
||||
assert_eq!(stdout("refs/tags/asdf"), "::set-output name=value::true\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn valid_version_is_not_prerelease() {
|
||||
assert_eq!(
|
||||
stdout("refs/tags/0.0.0"),
|
||||
"::set-output name=value::false\n"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn valid_version_with_trailing_characters_is_prerelease() {
|
||||
assert_eq!(
|
||||
stdout("refs/tags/0.0.0-rc1"),
|
||||
"::set-output name=value::true\n"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn valid_version_with_lots_of_digits_is_not_prerelease() {
|
||||
assert_eq!(
|
||||
stdout("refs/tags/01232132.098327498374.43268473849734"),
|
||||
"::set-output name=value::false\n"
|
||||
);
|
||||
}
|
2
justfile
2
justfile
@ -55,7 +55,7 @@ man:
|
||||
view-man: man
|
||||
man man/just.1
|
||||
|
||||
version := `sed -En 's/version[[:space:]]*=[[:space:]]*"([^"]+)"/v\1/p' Cargo.toml | head -1`
|
||||
version := `sed -En 's/version[[:space:]]*=[[:space:]]*"([^"]+)"/\1/p' Cargo.toml | head -1`
|
||||
|
||||
# add git log messages to changelog
|
||||
changes:
|
||||
|
1
rust-toolchain
Normal file
1
rust-toolchain
Normal file
@ -0,0 +1 @@
|
||||
1.52.1
|
@ -310,7 +310,7 @@ impl Config {
|
||||
))
|
||||
} else {
|
||||
app
|
||||
.version(concat!("v", env!("CARGO_PKG_VERSION")))
|
||||
.version(env!("CARGO_PKG_VERSION"))
|
||||
.author(env!("CARGO_PKG_AUTHORS"))
|
||||
.about(concat!(
|
||||
env!("CARGO_PKG_DESCRIPTION"),
|
||||
@ -900,7 +900,7 @@ mod tests {
|
||||
// have proper tests for all the flags, but this will do for now.
|
||||
#[test]
|
||||
fn help() {
|
||||
const EXPECTED_HELP: &str = "just v0.9.4
|
||||
const EXPECTED_HELP: &str = "just 0.9.4
|
||||
Casey Rodarmor <casey@rodarmor.com>
|
||||
🤖 Just a command runner \
|
||||
- https://github.com/casey/just
|
||||
|
@ -7,3 +7,4 @@ publish = false
|
||||
|
||||
[dependencies]
|
||||
tempfile = "3"
|
||||
just = { path = ".." }
|
||||
|
@ -123,39 +123,6 @@ macro_rules! tmptree {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn unindents() {
|
||||
assert_eq!(unindent("foo"), "foo");
|
||||
assert_eq!(unindent("foo\nbar\nbaz\n"), "foo\nbar\nbaz\n");
|
||||
assert_eq!(unindent(""), "");
|
||||
assert_eq!(unindent(" foo\n bar"), "foo\nbar");
|
||||
assert_eq!(unindent(" foo\n bar\n\n"), "foo\nbar\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn indentations() {
|
||||
assert_eq!(indentation(""), "");
|
||||
assert_eq!(indentation("foo"), "");
|
||||
assert_eq!(indentation(" foo"), " ");
|
||||
assert_eq!(indentation("\t\tfoo"), "\t\t");
|
||||
assert_eq!(indentation("\t \t foo"), "\t \t ");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn blanks() {
|
||||
assert!(blank(" \n"));
|
||||
assert!(!blank(" foo\n"));
|
||||
assert!(blank("\t\t\n"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn commons() {
|
||||
assert_eq!(common("foo", "foobar"), "foo");
|
||||
assert_eq!(common("foo", "bar"), "");
|
||||
assert_eq!(common("", ""), "");
|
||||
assert_eq!(common("", "bar"), "");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tmptree_file() {
|
||||
let tmpdir = tmptree! {
|
||||
|
Loading…
Reference in New Issue
Block a user