chore: Streamline getting version
This commit is contained in:
parent
cfc39817fc
commit
ac57f9e9f5
1 changed files with 20 additions and 9 deletions
29
Earthfile
29
Earthfile
|
|
@ -3,21 +3,15 @@ PROJECT blue-build/cli
|
||||||
|
|
||||||
IMPORT github.com/blue-build/earthly-lib/cargo AS cargo
|
IMPORT github.com/blue-build/earthly-lib/cargo AS cargo
|
||||||
|
|
||||||
ARG --global IMAGE=ghcr.io/blue-build/cli
|
FROM rust
|
||||||
|
|
||||||
FROM ghcr.io/blue-build/earthly-lib/cargo-builder
|
RUN apt-get update && apt-get install -y jq
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --keep-ts --dir src/ template/ recipe/ utils/ /app
|
COPY --keep-ts --dir src/ template/ recipe/ utils/ /app
|
||||||
COPY --keep-ts Cargo.* /app
|
COPY --keep-ts Cargo.* /app
|
||||||
COPY --keep-ts *.md /app
|
|
||||||
COPY --keep-ts LICENSE /app
|
|
||||||
COPY --keep-ts build.rs /app
|
|
||||||
COPY --keep-ts --dir .git/ /app
|
|
||||||
RUN touch build.rs
|
|
||||||
|
|
||||||
DO cargo+INIT
|
|
||||||
|
|
||||||
|
ARG --global IMAGE=ghcr.io/blue-build/cli
|
||||||
ARG --global VERSION="$(cargo metadata --format-version 1 | jq -r '.packages[] | select(.name == "blue-build") .version')"
|
ARG --global VERSION="$(cargo metadata --format-version 1 | jq -r '.packages[] | select(.name == "blue-build") .version')"
|
||||||
ARG --global MAJOR_VERSION="$(echo "$VERSION" | cut -d'.' -f1)"
|
ARG --global MAJOR_VERSION="$(echo "$VERSION" | cut -d'.' -f1)"
|
||||||
ARG --global MINOR_VERSION="$(echo "$VERSION" | cut -d'.' -f2)"
|
ARG --global MINOR_VERSION="$(echo "$VERSION" | cut -d'.' -f2)"
|
||||||
|
|
@ -39,18 +33,35 @@ build:
|
||||||
BUILD +installer
|
BUILD +installer
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
|
FROM +common
|
||||||
DO cargo+LINT
|
DO cargo+LINT
|
||||||
|
|
||||||
test:
|
test:
|
||||||
|
FROM +common
|
||||||
DO cargo+TEST
|
DO cargo+TEST
|
||||||
|
|
||||||
install:
|
install:
|
||||||
|
FROM +common
|
||||||
ARG --required BUILD_TARGET
|
ARG --required BUILD_TARGET
|
||||||
|
|
||||||
DO cargo+BUILD_RELEASE --BUILD_TARGET=$BUILD_TARGET
|
DO cargo+BUILD_RELEASE --BUILD_TARGET=$BUILD_TARGET
|
||||||
|
|
||||||
SAVE ARTIFACT target/$BUILD_TARGET/release/bluebuild
|
SAVE ARTIFACT target/$BUILD_TARGET/release/bluebuild
|
||||||
|
|
||||||
|
common:
|
||||||
|
FROM ghcr.io/blue-build/earthly-lib/cargo-builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --keep-ts --dir src/ template/ recipe/ utils/ /app
|
||||||
|
COPY --keep-ts Cargo.* /app
|
||||||
|
COPY --keep-ts *.md /app
|
||||||
|
COPY --keep-ts LICENSE /app
|
||||||
|
COPY --keep-ts build.rs /app
|
||||||
|
COPY --keep-ts --dir .git/ /app
|
||||||
|
RUN touch build.rs
|
||||||
|
|
||||||
|
DO cargo+INIT
|
||||||
|
|
||||||
build-scripts:
|
build-scripts:
|
||||||
FROM alpine
|
FROM alpine
|
||||||
LABEL org.opencontainers.image.source="https://github.com/blue-build/cli"
|
LABEL org.opencontainers.image.source="https://github.com/blue-build/cli"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue