Skip to content

Commit

Permalink
Use shared matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
cofob committed Aug 31, 2024
1 parent 4f4b062 commit cc592cb
Showing 1 changed file with 10 additions and 96 deletions.
106 changes: 10 additions & 96 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,11 @@ jobs:
run: nix run . -- validate

docker:
name: Build Docker container (x86_64)
name: Build Docker container
runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64, aarch64]
needs: build-nix
permissions:
contents: read
Expand All @@ -200,6 +203,10 @@ jobs:
with:
name: cofob
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: aarch64

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
Expand Down Expand Up @@ -250,7 +257,7 @@ jobs:
- name: Build remote
run: |
nix build .#fastside-docker
nix --system ${{ matrix.target }}-linux build .#fastside-docker
docker load < result
- name: Push to registry
Expand All @@ -263,100 +270,7 @@ jobs:
- name: Build baked
run: |
nix build .#fastside-docker-baked-services
docker load < result
- name: Push to registry
run: |
tags="${{ steps.meta2.outputs.tags }}"
for tag in $tags; do
docker tag fastside $tag
docker push $tag
done
docker-aarch64:
name: Build Docker container (aarch64)
runs-on: ubuntu-latest
needs: build-nix-aarch64
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: aarch64
- name: Setup Nix
uses: cachix/install-nix-action@v25
with:
nix_path: "${{ env.nix_path }}"
- name: Setup cachix
uses: cachix/cachix-action@v14
with:
name: cofob
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Lowercase repository name
id: repo
uses: ASzc/change-string-case-action@v6
with:
string: ${{ github.repository }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ steps.repo.outputs.lowercase }}-aarch64
tags: |
type=schedule
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
- name: Docker meta (baked)
id: meta2
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ steps.repo.outputs.lowercase }}-aarch64/baked
tags: |
type=schedule
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
- name: Build remote (aarch64)
run: |
nix --system aarch64-linux build .#fastside-docker
docker load < result
- name: Push to registry
run: |
tags="${{ steps.meta.outputs.tags }}"
for tag in $tags; do
docker tag fastside $tag
docker push $tag
done
- name: Build baked (aarch64)
run: |
nix --system aarch64-linux build .#fastside-docker-baked-services
nix --system ${{ matrix.target }}-linux build .#fastside-docker-baked-services
docker load < result
- name: Push to registry
Expand Down

0 comments on commit cc592cb

Please sign in to comment.