diff --git a/.github/gen_package_list.sh b/.github/gen_package_list.sh new file mode 100755 index 0000000..218fb94 --- /dev/null +++ b/.github/gen_package_list.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +packages="" +IFS=' +' +for line in $(dpkg -l --no-pager); do + case "$line" in + "ii"*) + items=$(echo "$line" | sed -E "s/\\s+/ /g") + name=$(echo "$items" | cut -d ' ' -f2 | cut -d ':' -f1) + version=$(echo "$items" | cut -d ' ' -f3) + packages="$packages{\"name\":\"$name\",\"version\":\"$version\"}," + ;; + esac +done + +packages="[${packages%,}]" +printf "\"packages\":%s\n" "$packages" \ No newline at end of file diff --git a/.github/workflows/differ.yml b/.github/workflows/differ.yml new file mode 100644 index 0000000..6f416e5 --- /dev/null +++ b/.github/workflows/differ.yml @@ -0,0 +1,29 @@ +name: Differ + +on: + workflow_run: + workflows: [Vib Build] + types: + - completed + +jobs: + differ: + runs-on: ubuntu-latest + container: + image: ghcr.io/vanilla-os/pico:main + + steps: + - uses: actions/checkout@v4 + + - name: Generate package diff + run: | + IMAGE_DIGEST=$(curl -s -L -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/orgs/Vanilla-OS/packages/container/pico/versions | grep -m1 name | sed -E 's/^\s*"name": "(.+)".*$/\1/') + PACKAGE_LIST=$(.github/gen_package_list.sh) + curl -X POST \ + -H 'Accept:application/json' \ + -H "Authorization:Basic $(echo -n "${{ secrets.DIFFER_USER }}:${{ secrets.DIFFER_PSW }}" | base64)" \ + -d "{\"digest\":\"${IMAGE_DIGEST}\",${PACKAGE_LIST}}" \ + $DIFFER_URL/images/pico/new \ No newline at end of file diff --git a/.github/workflows/vib-build.yml b/.github/workflows/vib-build.yml index c847c9e..32c4a69 100644 --- a/.github/workflows/vib-build.yml +++ b/.github/workflows/vib-build.yml @@ -31,6 +31,7 @@ jobs: chmod +x vib ./vib build recipe.yml sed -i '/\/var\/tmp\/*/{d}' Containerfile + - name: Build the Docker image run: docker image build -f Containerfile --tag ghcr.io/vanilla-os/pico:main . @@ -59,4 +60,4 @@ jobs: name: "Continuous Build" files: | rootfs/vanilla-pico.tar.gz - rootfs/SHA256SUMS + rootfs/SHA256SUMS \ No newline at end of file