GitHub

@@ -10,6 +10,7 @@ on:

1010

workflow_dispatch:

11111212

env:

13+

NIX_CONFIG: extra-experimental-features = nix-command flakes

1314

IMAGE_NAME: ghcr.io/${{ github.repository }}

14151516

jobs:

@@ -21,18 +22,9 @@ jobs:

2122

- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

2223

with:

2324

persist-credentials: false

24-

- working-directory: front

25-

run: nix shell nixpkgs#bun --command bun install --frozen-lockfile

26-

- working-directory: front

27-

run: nix shell nixpkgs#bun --command bun run format:check

28-

- working-directory: front

29-

run: nix shell nixpkgs#bun --command bun run lint

30-

- working-directory: front

31-

run: nix shell nixpkgs#bun --command bun run check

32-

- working-directory: front

33-

run: nix shell nixpkgs#bun --command bun run build

25+

- run: nix flake check --print-build-logs

342635-

container:

27+

publish:

3628

if: github.event_name == 'push'

3729

needs: check

3830

runs-on: [self-hosted, nixos]

@@ -51,27 +43,16 @@ jobs:

5143

type=raw,value=latest,enable=${{ github.ref_type == 'branch' && github.ref_name == github.event.repository.default_branch }}

5244

type=ref,event=branch,enable=${{ github.ref_name != github.event.repository.default_branch }}

5345

type=ref,event=tag

54-

- name: Build and push image

46+

- run: nix build .#dockerImage --print-build-logs

47+

- name: Push OCI image

5548

env:

5649

GHCR_TOKEN: ${{ github.token }}

5750

IMAGE_TAGS: ${{ steps.metadata.outputs.tags }}

58-

IMAGE_LABELS: ${{ steps.metadata.outputs.labels }}

5951

run: |

6052

umask 077

61-

authfile="$RUNNER_TEMP/podman-auth-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}.json"

53+

authfile="$RUNNER_TEMP/skopeo-auth-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}.json"

6254

trap 'rm -f "$authfile"' EXIT

63-

printf '%s' "$GHCR_TOKEN" | podman login --authfile "$authfile" ghcr.io --username "$GITHUB_ACTOR" --password-stdin

64-

podman pull --authfile "$authfile" "$IMAGE_NAME:latest" || true

65-66-

build_args=(--authfile "$authfile" --pull=always)

67-

while IFS= read -r tag; do

68-

[[ -n "$tag" ]] && build_args+=(--tag "$tag")

69-

done <<< "$IMAGE_TAGS"

70-

while IFS= read -r label; do

71-

[[ -n "$label" ]] && build_args+=(--label "$label")

72-

done <<< "$IMAGE_LABELS"

73-

podman build "${build_args[@]}" .

74-55+

printf '%s' "$GHCR_TOKEN" | nix run nixpkgs#skopeo -- login --authfile "$authfile" ghcr.io --username "$GITHUB_ACTOR" --password-stdin

7556

while IFS= read -r tag; do

76-

[[ -n "$tag" ]] && podman push --authfile "$authfile" "$tag"

57+

[[ -n "$tag" ]] && nix run nixpkgs#skopeo -- copy --authfile "$authfile" --insecure-policy docker-archive:result "docker://$tag"

7758

done <<< "$IMAGE_TAGS"

Read the original on github.com ↗