Skip to content

Commit

Permalink
add build pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
malaupa committed Jun 30, 2023
1 parent 864461e commit 9e19816
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: write

jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive

- name: Install build tools
run: sudo apt-get update && sudo apt-get install debhelper build-essential devscripts gcc-multilib binutils-dev pkg-config uuid-dev help2man gnu-efi -y
env:
DEBIAN_FRONTEND: noninteractive

- name: Build package
run: |+
debuild -i -uc -us -b
cd ..
echo "Result: $(ls *.deb)"
sha512sum *.deb > checksums.txt
cp *.deb checksums.txt ${{ github.workspace }}/
env:
GH_TOKEN: ${{ github.token }}
- name: Store package
uses: actions/upload-artifact@v3
with:
name: deb-package
path: |
*.deb
checksums.txt
retention-days: 10
# yaml-language-server: $schema=https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/github-workflow.json
63 changes: 63 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Release

on:
push:
tags:
- "*"

permissions:
contents: write

jobs:
release:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # to get commit messages
submodules: recursive

- name: Fetch Tags
run: git fetch --force --tags

- name: Install build tools
run: sudo apt-get update && sudo apt-get install debhelper build-essential devscripts gcc-multilib binutils-dev pkg-config uuid-dev help2man gnu-efi -y
env:
DEBIAN_FRONTEND: noninteractive

- name: Build package
run: |+
debuild -i -uc -us -b
cd ..
echo "Result: $(ls *.deb)"
sha512sum *.deb > checksums.txt
cp *.deb checksums.txt ${{ github.workspace }}/
gh release delete $TAG || true
gh release create $TAG --generate-notes ../*.deb ../checksums.txt
env:
GH_TOKEN: ${{ github.token }}

deploy:
runs-on: ubuntu-22.04
strategy:
matrix:
version: [jammy] # add others, if same package should be available in many versions
steps:
- name: Deploy
uses: actions/github-script@v6
with:
github-token: ${{ secrets.PULL_TOKEN }}
script: |+
github.rest.actions.createWorkflowDispatch({
owner: 'telekom-mms',
repo: 'linux-apt',
workflow_id: 'do_pull.yml',
ref: 'main',
inputs: {
repo: 'tpmsbsigntool',
version: '${{ matrix.version }}',
tag: '${{ github.ref_name }}'
}
});
# yaml-language-server: $schema=https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/github-workflow.json
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
build/
*.build
*.buildinfo
*.changes
*.deb
*.ddeb
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM ghcr.io/malaupa/ubuntu-deb-builder:latest
ARG USER_ID

RUN useradd user -u ${USER_ID}
RUN set -eu ; \
export DEBIAN_FRONTEND=noninteractive ; \
apt-get update -y && \
apt-get install --no-install-recommends -y \
gcc-multilib \
binutils-dev \
pkg-config \
uuid-dev \
help2man \
gnu-efi
12 changes: 12 additions & 0 deletions docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/bash
[[ -d "build" ]] && rm -rf build
mkdir build
shopt -s extglob
cp -R !(build) build
docker build --rm -t tpmsbsigntool-builder --build-arg="USER_ID=$UID" .
docker run --user=$UID --rm -v ./:/work tpmsbsigntool-builder /usr/bin/bash -c "cd /work/build && debuild -i -uc -us -b"
rm -rf build
rm *.build
rm *.buildinfo
rm *.changes
rm *.ddeb

0 comments on commit 9e19816

Please sign in to comment.