Skip to content

Publish buildkit daily container #814

Publish buildkit daily container

Publish buildkit daily container #814

name: Publish buildkit daily container
on:
schedule:
- cron: '0 17 * * *'
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{github.repository_owner}}/aosc-os-buildkit-daily
jobs:
tarball:
runs-on: [self-hosted, aosc-os, x64]
steps:
- name: Install aoscbootstrap
run: yes | sudo apt-get install -yf aoscbootstrap
- name: Build tarball
shell: 'script -eqc "bash --noprofile --norc -eo pipefail {0}"'
run: sudo generate-releases buildkit
- name: Upload tarball
uses: actions/upload-artifact@v4
with:
name: os-amd64-buildkit
path: os-amd64/buildkit
- name: Remove artifacts
if: always()
run: sudo rm -rf os-amd64 buildkit
docker:
needs: tarball
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download tarball
uses: actions/download-artifact@v4
with:
name: os-amd64-buildkit
- name: Get tarball date
uses: actions/github-script@v7
id: get-tarball-date
with:
script: |
let args = "";
const options = {};
options.listeners = {
stdout: (data) => {
args += data.toString();
}
};
await exec.exec('find', ['-maxdepth', '1', '-name', 'aosc-os_buildkit_*_amd64.tar.xz'], options);
const regex = /\.\/aosc-os_buildkit_(\d+)_amd64\.tar\.xz/;
const date = args.split('\n').map(arg => regex.exec(arg)).filter(arg => Array.isArray(arg)).map(arg => arg[1]);
if (!Array.isArray(date) || date.length != 1) throw "Too many tarballs!";
return Number(date[0]);
- name: Rename tarball
env:
DATE: ${{steps.get-tarball-date.outputs.result}}
run: mv aosc-os_buildkit_${DATE}_amd64.tar.xz .github/workflows/aosc-os_buildkit_amd64.tar.xz
- name: Log into registry ${{env.REGISTRY}}
uses: docker/login-action@v3
with:
registry: ${{env.REGISTRY}}
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}
tags: |
type=raw,latest
type=raw,${{steps.get-tarball-date.outputs.result}}
labels: |
org.opencontainers.image.title=AOSC OS BuildKit
org.opencontainers.image.description=AOSC OS Base with full development support.
org.opencontainers.image.url=https://aosc.io/
org.opencontainers.image.version=${{steps.get-tarball-date.outputs.result}}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .github/workflows
push: true
tags: ${{steps.meta.outputs.tags}}
labels: ${{steps.meta.outputs.labels}}