-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Joachim Wiberg <[email protected]>
- Loading branch information
Showing
1 changed file
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
name: Container Claus | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' | ||
tags: | ||
- '*' | ||
workflow_dispatch: | ||
|
||
env: | ||
IMAGE_NAME: curiOS | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: read | ||
strategy: | ||
matrix: | ||
platform: [amd64, arm64] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Build Variables | ||
id: vars | ||
run: | | ||
target=${{ matrix.platform }} | ||
echo "dir=curios-$target" >> $GITHUB_OUTPUT | ||
echo "tgz=curios-$target.tar.gz" >> $GITHUB_OUTPUT | ||
- name: Restore Cache of dl/ | ||
uses: actions/cache@v3 | ||
with: | ||
path: dl/ | ||
key: dl-${{ matrix.platform }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'configs/*', 'package/*/*.hash') }} | ||
restore-keys: | | ||
dl-${{ matrix.platform }}- | ||
dl- | ||
- name: Restore Cache of .ccache/ | ||
uses: actions/cache@v3 | ||
with: | ||
path: .ccache/ | ||
key: ccache-${{ matrix.platform }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'package/*/*.hash') }} | ||
restore-keys: | | ||
ccache-${{ matrix.platform }}- | ||
ccache- | ||
- name: Configure & Build | ||
run: | | ||
make curios_${{ matrix.platform }}_defconfig | ||
make | ||
- name: Prepare Artifact | ||
run: | | ||
cd output | ||
mv images ${{ steps.vars.outputs.dir }} | ||
ln -s ${{ steps.vars.outputs.dir }} images | ||
tar chfz ${{ steps.vars.outputs.tgz }} ${{ steps.vars.outputs.dir }} | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
path: output/${{ steps.vars.outputs.tgz }} | ||
|
||
push: | ||
if: ${{github.repository_owner == 'kernelkit' && github.ref_name == 'main'}} | ||
needs: build | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
- name: Prepare Aritfacts | ||
run: | | ||
for file in curios-*.tgz; do | ||
tar xf $file | ||
done | ||
mkdir rootfs-oci | ||
cp curios-*/* rootfs-oci/ | ||
jq -s '.[0].manifests=[.[].manifests|add]|.[0]' curios-*/index.json > rootfs-oci/index.json | ||
ls -l rootfs-oci/ | ||
cat rootfs-oci/index.json | ||
- name: Log in to registry | ||
run: | | ||
echo "${{ secrets.GITHUB_TOKEN }}" | skopeo login ghcr.io -u ${{ github.actor }} --password-stdin | ||
- name: Push image | ||
run: | | ||
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME | ||
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | ||
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | ||
[ "$VERSION" == "main" ] && VERSION=edge | ||
echo IMAGE_ID=$IMAGE_ID | ||
echo VERSION=$VERSION | ||
cd output/${{ steps.vars.outputs.dir }} | ||
ls -l | ||
skopeo copy oci:rootfs-oci:$VERSION docker://$IMAGE_ID:$VERSION |