From 3ca7323414f7e402b54a53cb7a76ee90ce2e682b Mon Sep 17 00:00:00 2001 From: seth Date: Wed, 7 Aug 2024 00:03:51 -0400 Subject: [PATCH] build(nix): use docker arch names for container --- .github/workflows/docker.yml | 30 +++++++++++++++++------------- flake.nix | 4 ++-- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index c150bf6..a3ce720 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -2,21 +2,24 @@ name: Docker on: push: - branches: ['main'] + branches: [ main ] pull_request: workflow_dispatch: jobs: build: name: Build image - runs-on: ubuntu-latest strategy: + fail-fast: false matrix: - arch: [x86_64, aarch64] + arch: [ amd64, arm64 ] + + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v4 - name: Install Nix uses: DeterminateSystems/nix-installer-action@v15 @@ -43,8 +46,10 @@ jobs: push: name: Push image - needs: build + + if: github.event_name == 'push' + runs-on: ubuntu-latest permissions: @@ -54,16 +59,15 @@ jobs: REGISTRY: ghcr.io USERNAME: ${{ github.actor }} - if: github.event_name == 'push' - steps: - - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v4 - name: Determine image name run: | echo "IMAGE_NAME=${REPOSITORY,,}" >> "$GITHUB_ENV" env: - REPOSITORY: '${{ github.repository }}' + REPOSITORY: ${{ github.repository }} - name: Download images uses: actions/download-artifact@v4 @@ -83,15 +87,15 @@ jobs: run: | set -eu - architectures=("x86_64" "aarch64") + architectures=("amd64" "arm64") for arch in "${architectures[@]}"; do docker load < images/container-"$arch"/*.tar.gz docker tag refraction:latest-"$arch" "$TAG"-"$arch" - docker push ${{ env.TAG }}-"$arch" + docker push "$TAG"-"$arch" done docker manifest create "$TAG" \ - --amend "$TAG"-x86_64 \ - --amend "$TAG"-aarch64 + --amend "$TAG"-amd64 \ + --amend "$TAG"-arm64 docker manifest push "$TAG" diff --git a/flake.nix b/flake.nix index d55c078..b009218 100644 --- a/flake.nix +++ b/flake.nix @@ -89,8 +89,8 @@ static-x86_64 = mkStatic { arch = "x86_64"; }; static-aarch64 = mkStatic { arch = "aarch64"; }; - container-x86_64 = containerize packages'.static-x86_64; - container-aarch64 = containerize packages'.static-aarch64; + container-amd64 = containerize packages'.static-x86_64; + container-arm64 = containerize packages'.static-aarch64; default = packages'.refraction; }