Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade main branch #35

Merged
merged 11 commits into from
Nov 10, 2024
31 changes: 0 additions & 31 deletions .github/workflows/differ.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
sudo apt install -y podman
sudo sh build.sh

- uses: vanilla-os/vib-gh-action@v0.7.4
- uses: vanilla-os/vib-gh-action@v0.8.1

- name: Create Checksum
working-directory: rootfs
Expand Down
61 changes: 47 additions & 14 deletions .github/workflows/vib-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Vib Build
on:
push:
branches:
- 'main'
- 'dev'
tags:
- '*'
workflow_dispatch:
Expand All @@ -12,39 +12,47 @@ on:
env:
BUILDX_NO_DEFAULT_ATTESTATIONS: 1

permissions:
contents: write # Allow actions to create release
packages: write # Allow pushing images to GHCR
attestations: write # To create and write attestations
id-token: write # Additional permissions for the persistence of the attestations

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write # Allow actions to create release
packages: write # Allow pushing images to GHCR
attestations: write # To create and write attestations
id-token: write # Additional permissions for the persistence of the attestations

steps:
- uses: actions/checkout@v4

- name: Install debootstrap from Ubuntu git
- name: Install debootstrap
run: |
sudo git clone --depth 1 https://git.launchpad.net/ubuntu/+source/debootstrap /debootstrap
sudo chmod a+x /debootstrap/debootstrap
sudo ln -s /debootstrap/debootstrap -t /usr/local/bin
sudo apt-get update
sudo apt-get install -y debootstrap

- name: Rootfs
working-directory: rootfs
run: |
sudo apt install -y podman
sudo sh build.sh

- uses: vanilla-os/vib-gh-action@v0.7.4
- uses: vanilla-os/vib-gh-action@v0.8.1

- name: Generate image name
run: |
REPO_OWNER_LOWERCASE="$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')"
echo "REPO_OWNER_LOWERCASE=$REPO_OWNER_LOWERCASE" >> "$GITHUB_ENV"
echo "IMAGE_URL=ghcr.io/$REPO_OWNER_LOWERCASE/pico" >> "$GITHUB_ENV"

- name: Extra image tag branch
if: ${{ github.ref_type != 'tag' }}
run: |
echo "EXTRA_TAG=ref,event=branch" >> "$GITHUB_ENV"

- name: Extra image tag release
if: ${{ github.ref_type == 'tag' }}
run: |
echo "EXTRA_TAG=raw,main" >> "$GITHUB_ENV"

- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v5
Expand All @@ -56,7 +64,7 @@ jobs:
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{raw}}
type=semver,pattern=v{{major}}
type=ref,event=branch
type=${{ env.EXTRA_TAG }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand Down Expand Up @@ -103,7 +111,7 @@ jobs:
path: rootfs/vanilla-pico.tar.zst

- uses: softprops/action-gh-release@v2
if: github.repository == 'vanilla-os/pico-image' && github.ref == 'refs/heads/main'
if: ${{ github.event_name != 'pull_request' }}
with:
token: "${{ secrets.GITHUB_TOKEN }}"
tag_name: "continuous"
Expand All @@ -112,3 +120,28 @@ jobs:
files: |
rootfs/vanilla-pico.tar.gz
rootfs/checksum.txt

differ:
runs-on: ubuntu-latest
if: github.ref_type == 'tag' && github.repository == 'vanilla-os/pico-image'
needs: build
container:
image: ghcr.io/vanilla-os/pico:main

steps:
- uses: actions/checkout@v4

- name: Generate package diff
run: |
PACKAGE_LIST=$(.github/gen_package_list.sh)
apt install -f -y
apt 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/pico/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/pico/new
2 changes: 2 additions & 0 deletions rootfs/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set -e

# Rootfs definitions
ROOTFS_NAME="vanilla-pico"
REPO_URL=http://repo2.vanillaos.org
Expand Down
Loading