Allow to specify git directory when releasing
Some checks failed
/ push (push) Failing after 1m4s

This commit is contained in:
Pim Kunis 2024-04-28 17:21:12 +02:00
parent 300aa7df45
commit 02dea6fe5c
2 changed files with 4 additions and 3 deletions

View file

@ -18,7 +18,7 @@ jobs:
- name: Push Pim's blog to Nix cache - name: Push Pim's blog to Nix cache
run: /bin/attic push home blog-pim run: /bin/attic push home blog-pim
- name: Push Pim's blog to container registry - name: Push Pim's blog to container registry
run: nix --extra-experimental-features "nix-command flakes" run ./checkout#packages.x86_64-linux.release ./checkout#packages.x86_64-linux.blog-pim blog-pim run: nix --extra-experimental-features "nix-command flakes" run ./checkout#packages.x86_64-linux.release ./checkout#packages.x86_64-linux.blog-pim blog-pim ./checkout
- name: Build forgejo-nix-action - name: Build forgejo-nix-action
run: nix build --extra-experimental-features nix-command --extra-experimental-features flakes --no-allow-dirty --out-link forgejo-nix-action ./checkout#packages.x86_64-linux.forgejo-nix-action run: nix build --extra-experimental-features nix-command --extra-experimental-features flakes --no-allow-dirty --out-link forgejo-nix-action ./checkout#packages.x86_64-linux.forgejo-nix-action
- name: Push forgjeo-nix-action to Nix cache - name: Push forgjeo-nix-action to Nix cache

View file

@ -5,17 +5,18 @@ IFS=$'\n\t'
flakeref="${1-}" flakeref="${1-}"
name="${2-}" name="${2-}"
gitdir="${3:-.}"
if [ -z "$flakeref" ] || [ -z "$name" ]; if [ -z "$flakeref" ] || [ -z "$name" ];
then then
echo "Usage: $0 FLAKEREF NAME" echo "Usage: $0 FLAKEREF NAME [GITDIR]"
exit 1 exit 1
fi fi
imagename=$(nix eval --no-allow-dirty --raw $flakeref.imageName) imagename=$(nix eval --no-allow-dirty --raw $flakeref.imageName)
imagetag=$(nix eval --no-allow-dirty --raw $flakeref.imageTag) imagetag=$(nix eval --no-allow-dirty --raw $flakeref.imageTag)
image=$(nix build --no-allow-dirty $flakeref --print-out-paths --no-link) image=$(nix build --no-allow-dirty $flakeref --print-out-paths --no-link)
gitrev=$(git rev-parse HEAD) gitrev=$(git --git-dir $gitdir/.git --work-tree $gitdir rev-parse HEAD)
docker load < $image docker load < $image
docker tag $imagename:$imagetag git.kun.is/home/$name:$gitrev docker tag $imagename:$imagetag git.kun.is/home/$name:$gitrev