From fc720bba2d31ebf99a08c7f625d1a9f9c3163d01 Mon Sep 17 00:00:00 2001 From: Fernando Ayats Date: Wed, 13 Dec 2023 23:03:02 +0000 Subject: [PATCH] automatic git tags --- .envrc | 1 + .github/workflows/tag.yaml | 35 +++++++++++++++++++++++++++++++++++ .github/workflows/update.yaml | 10 ++++------ Cargo.lock | 2 +- Cargo.toml | 2 +- devshell.nix | 6 ++++-- 6 files changed, 46 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/tag.yaml diff --git a/.envrc b/.envrc index 25c13a3..a43b162 100644 --- a/.envrc +++ b/.envrc @@ -1,4 +1,5 @@ watch_file flake.nix watch_file flake.lock +watch_file devshell.nix use flake \ No newline at end of file diff --git a/.github/workflows/tag.yaml b/.github/workflows/tag.yaml new file mode 100644 index 0000000..6b38f70 --- /dev/null +++ b/.github/workflows/tag.yaml @@ -0,0 +1,35 @@ +name: Tag version + +on: + workflow_dispatch: + push: + branches: + - master + +jobs: + main: + runs-on: ubuntu-latest + steps: + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@main + + - uses: actions/checkout@v3 + name: Checkout + + - run: | + echo -n "nh_version=v" >> "$GITHUB_ENV" + nix shell nixpkgs#nushell -c \ + nu -c "open Cargo.toml | get package | get version" \ + >> "$GITHUB_ENV" + name: Read version + + - name: Tag + run: | + set -x + set +e + git show-ref --tags $nh_version --quiet + + if [[ $? -ne 0 ]]; then + git tag $nh_version + git push --tags + fi diff --git a/.github/workflows/update.yaml b/.github/workflows/update.yaml index 134a236..a3e2c29 100644 --- a/.github/workflows/update.yaml +++ b/.github/workflows/update.yaml @@ -17,15 +17,13 @@ jobs: name: Checkout - run: nix flake update + name: Bump flake.lock - - run: nix profile install --inputs-from . nixpkgs#cargo nixpkgs#rustc - - - run: | - cargo install cargo-bump - cargo bump - name: Bump version + - run: nix run --inputs-from . nixpkgs#cargo-bump + name: Bump Cargo.toml - run: cargo update + name: Bump Cargo.lock - name: Create Pull Request uses: peter-evans/create-pull-request@v4 diff --git a/Cargo.lock b/Cargo.lock index 3165d1f..fc847a9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -476,7 +476,7 @@ dependencies = [ [[package]] name = "nh" -version = "3.4.12" +version = "3.4.13" dependencies = [ "ambassador", "anstyle", diff --git a/Cargo.toml b/Cargo.toml index 4e75ede..300cfc8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nh" -version = "3.4.12" +version = "3.4.13" edition = "2021" license = "EUPL-1.2" diff --git a/devshell.nix b/devshell.nix index 125cb0d..2b553b0 100644 --- a/devshell.nix +++ b/devshell.nix @@ -1,12 +1,13 @@ { mkShell, - rust-analyzer, + rust-analyzer-unwrapped, rustfmt, clippy, nvd, nix-output-monitor, cargo, rustc, + rustPlatform, }: mkShell { strictDeps = true; @@ -15,7 +16,7 @@ mkShell { cargo rustc - rust-analyzer + rust-analyzer-unwrapped rustfmt clippy nvd @@ -26,5 +27,6 @@ mkShell { env = { NH_NOM = "1"; + RUST_SRC_PATH = "${rustPlatform.rustLibSrc}"; }; }