Skip to content

Commit f30c560

Browse files
author
kennethdashensheridan
committed
updated CICD for nix and debian artifact
1 parent 18dc1f5 commit f30c560

1 file changed

Lines changed: 12 additions & 25 deletions

File tree

.github/workflows/nix-release.yml

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -139,33 +139,20 @@ jobs:
139139
140140
- name: Build Docker image with Nix
141141
run: |
142-
# Create a Docker image derivation
143-
cat > docker.nix << 'EOF'
144-
{ pkgs ? import <nixpkgs> {} }:
145-
let
146-
hardware_report = (builtins.getFlake (toString ./.)).packages.${pkgs.system}.default;
147-
in
148-
pkgs.dockerTools.buildImage {
149-
name = "hardware-report";
150-
tag = "${{ needs.create-release.outputs.version }}";
151-
config = {
152-
Cmd = [ "${hardware_report}/bin/hardware_report" ];
153-
Env = [
154-
"PATH=${pkgs.lib.makeBinPath (with pkgs; [
155-
numactl ipmitool ethtool util-linux pciutils
156-
])}:/usr/local/bin:/usr/bin:/bin"
157-
];
158-
};
159-
}
160-
EOF
161-
162-
nix-build docker.nix -o docker-image
163-
docker load < docker-image
142+
nix build .#dockerImage --print-build-logs
143+
docker load < result
164144
165-
- name: Push to GitHub Container Registry
145+
- name: Tag and Push to GitHub Container Registry
166146
run: |
147+
# Get the image name and tag from the loaded image
148+
IMAGE_ID=$(docker images --format "{{.Repository}}:{{.Tag}}" | grep "hardware-report:latest" | head -n1)
149+
167150
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
168-
docker tag hardware-report:${{ needs.create-release.outputs.version }} ghcr.io/${{ github.repository_owner }}/hardware-report:${{ needs.create-release.outputs.version }}
169-
docker tag hardware-report:${{ needs.create-release.outputs.version }} ghcr.io/${{ github.repository_owner }}/hardware-report:latest
151+
152+
# Tag for version and latest
153+
docker tag $IMAGE_ID ghcr.io/${{ github.repository_owner }}/hardware-report:${{ needs.create-release.outputs.version }}
154+
docker tag $IMAGE_ID ghcr.io/${{ github.repository_owner }}/hardware-report:latest
155+
156+
# Push both tags
170157
docker push ghcr.io/${{ github.repository_owner }}/hardware-report:${{ needs.create-release.outputs.version }}
171158
docker push ghcr.io/${{ github.repository_owner }}/hardware-report:latest

0 commit comments

Comments
 (0)