Skip to content

Build Containerd

Build Containerd #24

Workflow file for this run

name: Build Containerd
on:
workflow_dispatch:
schedule:
- cron: '0 20 * * *'
jobs:
check-package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: Get Version
run: |
CONTAINERD_VERSION=v$(curl -sSL https://github.com/docker/containerd-packaging/raw/master/debian/changelog | head -n 1 | grep -oP '\(\K[^\)]+' | cut -d'-' -f1)
sed -i "s@CONTAINERD_VERSION=.*@CONTAINERD_VERSION=${CONTAINERD_VERSION}@g" build-containerd.sh
echo "CONTAINERD_VERSION=${CONTAINERD_VERSION}" >> $GITHUB_ENV
echo ""
echo "========== Build Args =========="
echo "CONTAINERD_VERSION=${CONTAINERD_VERSION}"
- name: Check Release
id: check-release
run: |
gh release view ${{ env.CONTAINERD_VERSION }} -R ${{ github.repository }} >/dev/null 2>&1 || echo "create=1" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Tag
if : steps.check-release.outputs.create == '1'
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git add .
git commit -m "Release ${{ env.CONTAINERD_VERSION }}" || true
git tag ${{ env.CONTAINERD_VERSION }}
git push origin ${{ env.CONTAINERD_VERSION }} || true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
if : steps.check-release.outputs.create == '1'
run: |
gh release create ${{ env.CONTAINERD_VERSION }} -R ${{ github.repository }} --title ${{ env.CONTAINERD_VERSION }} --notes "**Full Changelog**: [${{ env.CONTAINERD_VERSION }}](https://github.com/containerd/containerd/releases/tag/${{ env.CONTAINERD_VERSION }})"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
check-binaries:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: Get Version
run: |
CONTAINERD_VERSION=$(curl -s "https://api.github.com/repos/containerd/containerd/releases/latest" | jq -r .tag_name)
echo "CONTAINERD_VERSION=${CONTAINERD_VERSION}" >> $GITHUB_ENV
sed -i "s@ARG CONTAINERD_VERSION=.*@ARG CONTAINERD_VERSION=${CONTAINERD_VERSION}@g" binaries/Dockerfile
echo ""
echo "========== Build Args =========="
echo "CONTAINERD_VERSION=${CONTAINERD_VERSION}"
- name: Check Release
id: check-release
run: |
gh release view ${{ env.CONTAINERD_VERSION }} -R ${{ github.repository }} >/dev/null 2>&1 || echo "create=1" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Tag
if : steps.check-release.outputs.create == '1'
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git add .
git commit -m "Release ${{ env.CONTAINERD_VERSION }}" || true
git tag ${{ env.CONTAINERD_VERSION }}
git push origin ${{ env.CONTAINERD_VERSION }} || true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
if : steps.check-release.outputs.create == '1'
run: |
gh release create ${{ env.CONTAINERD_VERSION }} -R ${{ github.repository }} --title ${{ env.CONTAINERD_VERSION }} --notes "**Full Changelog**: [${{ env.CONTAINERD_VERSION }}](https://github.com/containerd/containerd/releases/tag/${{ env.CONTAINERD_VERSION }})"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-binaries:
runs-on: ubuntu-latest
needs: check-binaries
steps:
- name: Get Version
run: |
CONTAINERD_VERSION=$(curl -s "https://api.github.com/repos/containerd/containerd/releases/latest" | jq -r .tag_name)
echo "CONTAINERD_VERSION=${CONTAINERD_VERSION}" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
ref: ${{ env.CONTAINERD_VERSION }}
- uses: docker/setup-buildx-action@v3
- name: Check Release
id: create-binaries
run: |
gh release view ${{ env.CONTAINERD_VERSION }} -R ${{ github.repository }} | grep containerd-.*.tar.gz >/dev/null 2>&1 || echo "create=1" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup QEMU
if : steps.create-binaries.outputs.create == '1'
run: docker run --rm --privileged ghcr.io/loong64/qemu-user-static --reset -p yes
- name: Build Containerd Binaries
if : steps.create-binaries.outputs.create == '1'
run: |
cd binaries
docker buildx build --platform linux/loong64 -t containerd-static-loong64:${{ env.CONTAINERD_VERSION }} . --load
- name: Upgrade Release
if : steps.create-binaries.outputs.create == '1'
run: |
docker run --rm -v $(pwd)/dist:/dist containerd-static-loong64:${{ env.CONTAINERD_VERSION }}
ls -al dist
gh release upload ${{ env.CONTAINERD_VERSION }} -R ${{ github.repository }} dist/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-package:
runs-on: ubuntu-latest
needs: check-package
steps:
- name: Get Version
run: |
CONTAINERD_VERSION=v$(curl -sSL https://github.com/docker/containerd-packaging/raw/master/debian/changelog | head -n 1 | grep -oP '\(\K[^\)]+' | cut -d'-' -f1)
echo "CONTAINERD_VERSION=${CONTAINERD_VERSION}" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
ref: ${{ env.CONTAINERD_VERSION }}
- uses: docker/setup-buildx-action@v3
- name: Check Release
id: create-package
run: |
gh release view ${{ env.CONTAINERD_VERSION }} -R ${{ github.repository }} | grep containerd.*.deb >/dev/null 2>&1 || echo "create=1" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup QEMU
if : steps.create-package.outputs.create == '1'
run: docker run --rm --privileged ghcr.io/loong64/qemu-user-static --reset -p yes
- name: Build Containerd Package
if : steps.create-package.outputs.create == '1'
run: |
bash build-containerd.sh
- name: Upgrade Release
if : steps.create-package.outputs.create == '1'
run: |
ls -al dist
gh release upload ${{ env.CONTAINERD_VERSION }} -R ${{ github.repository }} dist/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}