1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
name: Build deb package
on:
workflow_call:
inputs:
runs-on:
description: 'A json list of tags to indicate which runner to use'
required: true
type: string
os:
description: 'The OS to build the deb package for'
required: true
type: string
os-version:
description: 'The OS version to build the deb package for'
required: true
type: string
system:
description: 'The system name as known by spread'
required: true
type: string
jobs:
build-deb:
runs-on: ${{ fromJSON(inputs.runs-on) }}
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Download vendor
uses: actions/download-artifact@v5
with:
name: vendor-pkgs
path: /tmp/pkg
- name: Extract vendor
run: |
mkdir /tmp/vendor-dir
tar -xf /tmp/pkg/snapd*.vendor.tar.xz -C /tmp/vendor-dir
mv /tmp/vendor-dir/snapd-*/vendor .
mv /tmp/vendor-dir/snapd-*/c-vendor/* c-vendor/
- name: Setup debian dir
run: |
if [ -d "packaging/${{ inputs.os }}-${{ inputs.os-version }}" ]; then
rm -r debian
mv "packaging/${{ inputs.os }}-${{ inputs.os-version }}" debian
fi
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image with cache support
uses: docker/build-push-action@v5
with:
context: .
push: false
load: true
file: tests/lib/packaging/debian.dockerfile
build-args: |
SYSTEM=${{ inputs.os }}
TAG=${{ inputs.os-version }}
tags: deb-base:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build deb
run: |
chmod a+w ../
chmod -R a+w .
mkdir -p /tmp/builds
chmod -R a+w /tmp/builds
docker run --cap-add SYS_ADMIN --rm \
--mount type=bind,src=$(dirname $(pwd)),dst=/home/test/snapd-parent \
--mount type=bind,src=/tmp/builds,dst=/tmp/builds \
deb-base:latest \
bash -c "
chown -R test:test /home/test/snapd-parent/snapd && \
cd /home/test/snapd-parent/snapd && \
tests/lib/packaging/build-deb.sh --user test --pkg-version "$(cat /tmp/pkg/version)" && \
cp /home/test/snapd-parent/*.deb /tmp/builds
"
- name: upload packages
uses: actions/upload-artifact@v4
with:
name: package-${{ inputs.system }}
path: /tmp/builds/
|