Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mirkobrombin committed Jan 9, 2024
0 parents commit bf67abb
Show file tree
Hide file tree
Showing 11 changed files with 836 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ref: https://git-scm.com/docs/gitattributes
* text=auto eol=lf
4 changes: 4 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# These are supported funding model platforms

github: vanilla-os
liberapay: fabricators
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
18 changes: 18 additions & 0 deletions .github/gen_package_list.sh
Original file line number Diff line number Diff line change
@@ -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"
32 changes: 32 additions & 0 deletions .github/workflows/differ.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Differ

on:
workflow_run:
workflows: [Vib Build]
types:
- completed

jobs:
differ:
runs-on: ubuntu-latest
container:
image: ghcr.io/vanilla-os/vm:main

steps:
- uses: actions/checkout@v4

- name: Generate package diff
run: |
lpkg --unlock
PACKAGE_LIST=$(.github/gen_package_list.sh)
apt-get install -y curl
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/vm/versions | grep -m1 name | sed -E 's/^\s*"name": "(.+)".*$/\1/')
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}}" \
${{ vars.DIFFER_URL }}/images/vm/new
lpkg --lock
31 changes: 31 additions & 0 deletions .github/workflows/vib-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Vib Build

on:
push:
branches: [ "main" ]
workflow_dispatch:

env:
REGISTRY_USER: ${{ github.actor }}
REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: vanilla-os/[email protected]

- name: Build the Docker image
run: docker image build -f Containerfile --tag ghcr.io/vanilla-os/vm:main .

# Push the image to GHCR (Image Registry)
- name: Push To GHCR
if: github.repository == 'vanilla-os/vm-image'
run: |
docker login ghcr.io -u ${{ env.REGISTRY_USER }} -p ${{ env.REGISTRY_PASSWORD }}
docker image push "ghcr.io/vanilla-os/vm:main"
24 changes: 24 additions & 0 deletions .github/workflows/vib-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Vib PR

on:
pull_request:
branches: [ "main" ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: vanilla-os/[email protected]

- name: Build the Docker image
run: docker image build -f Containerfile --tag vanillaos/vm:validation .

- uses: actions/upload-artifact@v4
with:
name: Containerfile
path: Containerfile
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Containerfile
sources/
downloads/
Loading

0 comments on commit bf67abb

Please sign in to comment.