summaryrefslogtreecommitdiff
path: root/.github/workflows/docker.yaml
diff options
context:
space:
mode:
authorseth <[email protected]>2023-12-16 00:34:10 -0500
committerseth <[email protected]>2023-12-16 11:29:01 -0500
commit51c97f77ae11d4eb8e5c38a9f5d0b5ca9d8e3da4 (patch)
tree7a7e32f0ff01549252fb205886c602f919c8b211 /.github/workflows/docker.yaml
parentbd2966db8f3660c03039a0f6ab03e850f0e17d45 (diff)
ci: back to garnix
Diffstat (limited to '.github/workflows/docker.yaml')
-rw-r--r--.github/workflows/docker.yaml60
1 files changed, 47 insertions, 13 deletions
diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml
index a2873ed..6654e6a 100644
--- a/.github/workflows/docker.yaml
+++ b/.github/workflows/docker.yaml
@@ -1,12 +1,53 @@
name: Push to image registry
on:
- workflow_call:
+ check_suite:
+ types: [completed]
workflow_dispatch:
jobs:
+ build:
+ name: Build image
+
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ arch: [x86_64, aarch64]
+
+ # https://github.com/sellout/bash-strict-mode/commit/9bf1d65c2f786a9887facfcb81e06d8b8b5f4667
+ if: github.event.check_suite.app.name == 'Garnix CI'
+ && github.event.check_suite.conclusion == 'success'
+ && github.event.check_suite.latest_check_runs_count >= 8
+ && github.event.check_suite.head_branch == 'main'
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Install Nix
+ uses: DeterminateSystems/nix-installer-action@v9
+
+ - name: Setup Nix cache
+ uses: DeterminateSystems/magic-nix-cache-action@v2
+
+ - name: Build Docker image
+ id: build
+ run: |
+ nix build -L --accept-flake-config .#container-${{ matrix.arch }}
+ [ ! -L result ] && exit 1
+ echo "path=$(realpath result)" >> "$GITHUB_OUTPUT"
+
+ - name: Upload image
+ uses: actions/upload-artifact@v3
+ with:
+ name: container-${{ matrix.arch }}
+ path: ${{ steps.build.outputs.path }}
+ if-no-files-found: error
+ retention-days: 1
+
push:
name: Push image
+
+ needs: build
runs-on: ubuntu-latest
permissions:
@@ -23,15 +64,10 @@ jobs:
- uses: actions/checkout@v4
- - name: Install Nix
- uses: DeterminateSystems/nix-installer-action@v9
-
- - name: Setup Attic cache
- uses: ryanccn/attic-action@v0
+ - name: Download images
+ uses: actions/download-artifact@v3
with:
- endpoint: https://cache.mydadleft.me
- cache: teawiebot
- token: ${{ secrets.ATTIC_TOKEN }}
+ path: images
- name: Login to registry
uses: docker/login-action@v3
@@ -48,11 +84,9 @@ jobs:
architectures=("x86_64" "aarch64")
for arch in "${architectures[@]}"; do
- nix build -L --accept-flake-config .#container-"$arch"
- docker load < result
- docker tag ${{ env.IMAGE_NAME }}:latest-"$arch" ${{ env.TAG }}-"$arch"
+ docker load < images/container-"$arch"/*.tar.gz
+ docker tag teawiebot:latest-"$arch" ${{ env.TAG }}-"$arch"
docker push ${{ env.TAG }}-"$arch"
- rm result
done
docker manifest create ${{ env.TAG }} \