Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/ci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ FROM build as deb_make
ARG GIT_VERSION
ARG BUILD_TYPE="generic"
ENV DEB_BUILD_PROFILES="$BUILD_TYPE"
ARG DEB_REVISION="1"

RUN apt-get build-dep -y $PWD
RUN . /etc/os-release && \
export RELEASE_SUFFIX="$VERSION_CODENAME" && \
export RELEASE_SUFFIX="$VERSION_CODENAME-$DEB_REVISION" && \
dpkg-buildpackage -us -uc -b

RUN mkdir -p /deb && mv ../*.deb /deb/
104 changes: 104 additions & 0 deletions .github/workflows/build_revision.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: "Build package revisions for latest release"

on:
workflow_dispatch:
inputs:
tag:
description: "release to revision"
required: false
default: ''
deb_revision:
description: "Revision to use for the debian packages"
required: false
default: ''

jobs:
vars:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.get_tag.outputs.tag }}
revision: ${{ steps.get_revision.outputs.revision }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- name: Determine latest tag
id: get_tag
run: |
set -e
tag="${{ github.event.inputs.tag }}"
if [[ -z "$tag" ]]; then
tag=$(git describe --tags --abbrev=0)
fi
echo "Set tag to $tag"
echo "tag=$tag" >> "$GITHUB_OUTPUT"
echo "GIT_VERSION=$tag" >> "$GITHUB_ENV"
- name: Determine latest revision
id: get_revision
run: |
set -e
revision="${{ github.event.inputs.deb_revision }}"
if [[ -z "$revision" ]]; then
current=$(curl -s https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/${GIT_VERSION} | jq -r ".assets[].name" | grep "camera-streamer-raspi.*_armhf.deb" | cut -d "_" -f 2 | cut -d "-" -f 2 | sort -nr | head -n1)
echo "Found current revision $current"
revision=$(expr $current + 1)
fi
echo "Set revision to $revision"
echo "revision=$revision" >> "$GITHUB_OUTPUT"

build:
runs-on: ubuntu-latest
needs: vars
permissions:
contents: write
strategy:
matrix:
debian_version: [bullseye]
docker_arch: [amd64, arm32v7, arm64v8]
build_type: [generic, raspi]
exclude:
- docker_arch: amd64
build_type: raspi
- debian_version: buster
build_type: raspi
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
ref: ${{ needs.vars.outputs.tag }}
- name: Set GIT_VERSION
run: echo "GIT_VERSION=$(git describe --tags)" >> $GITHUB_ENV
- name: Set DEB_REVISION
shell: bash
run: |
revision="${{ needs.vars.outputs.revision }}"
if [[ -n "$revision" ]]; then
echo "DEB_REVISION=${revision}" >> $GITHUB_ENV
else
echo "DEB_REVISION=1" >> $GITHUB_ENV
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Build Dockerfile
run: docker build --target deb_make --tag deb_make --file .github/ci/Dockerfile --build-arg GIT_VERSION --build-arg DEB_REVISION --build-arg DOCKER_ARCH --build-arg DEBIAN_VERSION --build-arg BUILD_TYPE .
env:
DEBIAN_VERSION: ${{ matrix.debian_version }}
DOCKER_ARCH: ${{ matrix.docker_arch }}/
BUILD_TYPE: ${{ matrix.build_type }}
- name: Create container
run: docker create --name deb_make deb_make
- name: Copy files
run: 'docker cp deb_make:/deb/. deb/'
- name: 'Release debian files'
uses: ncipollo/release-action@v1
with:
tag: "${{ env.GIT_VERSION }}"
artifacts: "deb/*.deb"
allowUpdates: true
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true
Loading