Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,18 @@ name: CI
- master

jobs:
setup:
runs-on: ubuntu-latest
outputs:
week: ${{ steps.date.outputs.week }}
steps:
- name: Get current date
id: date
run: echo "week=$(date +'%Y-%U')" >> "$GITHUB_OUTPUT"

build:
runs-on: ubuntu-latest
needs: [setup]
permissions:
contents: read
strategy:
Expand All @@ -20,6 +30,8 @@ jobs:
- arch: armv6l
- arch: aarch64
- arch: x86_64
env:
CACHE_KEY: build-${{ matrix.arch }}-${{ needs.setup.outputs.week }}

steps:
- name: Checkout
Expand Down Expand Up @@ -47,8 +59,8 @@ jobs:
build-args: |
ARCH=${{ matrix.arch }}
outputs: type=local,dest=dist
cache-from: type=gha,scope=build-${{ matrix.arch }}
cache-to: type=gha,mode=max,scope=build-${{ matrix.arch }}
cache-from: type=gha,scope=${{ env.CACHE_KEY }}
cache-to: type=gha,mode=max,scope=${{ env.CACHE_KEY }}

- name: Upload artifact
id: upload-initramfs
Expand All @@ -73,7 +85,7 @@ jobs:
INSTALL_PACKAGES=xbps-triggers dropbear pam sudo
ROOTFS=extrarootfs
outputs: type=local,dest=dist-extra
cache-from: type=gha,scope=build-${{ matrix.arch }}
cache-from: type=gha,scope=${{ env.CACHE_KEY }}
cache-to: "" # don't write to cache for the extra initramfs

- name: Upload extra initramfs artifact
Expand Down Expand Up @@ -167,7 +179,7 @@ jobs:

publish:
runs-on: ubuntu-latest
needs: [test]
needs: [test, setup]
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
permissions:
contents: read
Expand All @@ -178,6 +190,8 @@ jobs:
- arch: armv6l
- arch: aarch64
- arch: x86_64
env:
CACHE_KEY: build-${{ matrix.arch }}-${{ needs.setup.outputs.week }}
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
Expand Down Expand Up @@ -237,8 +251,8 @@ jobs:
push: true
tags: ${{ steps.meta-busybox.outputs.tags }}
labels: ${{ steps.meta-busybox.outputs.labels }}
cache-from: type=gha,scope=build-${{ matrix.arch }}
cache-to: type=gha,mode=max,scope=build-${{ matrix.arch }}
cache-from: type=gha,scope=${{ env.CACHE_KEY }}
cache-to: type=gha,mode=max,scope=${{ env.CACHE_KEY }}

- name: Build and push rootfs to GHCR
uses: >-
Expand All @@ -253,5 +267,5 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=build-${{ matrix.arch }}
cache-to: type=gha,mode=max,scope=build-${{ matrix.arch }}
cache-from: type=gha,scope=${{ env.CACHE_KEY }}
cache-to: type=gha,mode=max,scope=${{ env.CACHE_KEY }}