Skip to content

Commit

Permalink
automatic git tags
Browse files Browse the repository at this point in the history
  • Loading branch information
viperML committed Dec 13, 2023
1 parent a905fc7 commit 0ec3bee
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 10 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
watch_file flake.nix
watch_file flake.lock
watch_file devshell.nix

use flake
36 changes: 36 additions & 0 deletions .github/workflows/tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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
set -e
if [[ $? -ne 0 ]]; then
git tag $nh_version
git push --tags
fi
10 changes: 4 additions & 6 deletions .github/workflows/update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "nh"
version = "3.4.12"
version = "3.4.13"
edition = "2021"
license = "EUPL-1.2"

Expand Down
6 changes: 4 additions & 2 deletions devshell.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
mkShell,
rust-analyzer,
rust-analyzer-unwrapped,
rustfmt,
clippy,
nvd,
nix-output-monitor,
cargo,
rustc,
rustPlatform,
}:
mkShell {
strictDeps = true;
Expand All @@ -15,7 +16,7 @@ mkShell {
cargo
rustc

rust-analyzer
rust-analyzer-unwrapped
rustfmt
clippy
nvd
Expand All @@ -26,5 +27,6 @@ mkShell {

env = {
NH_NOM = "1";
RUST_SRC_PATH = "${rustPlatform.rustLibSrc}";
};
}

0 comments on commit 0ec3bee

Please sign in to comment.