2021-07-14 20:21:29 +02:00
|
|
|
name: Hyperion APT Build
|
2021-11-21 14:26:17 +01:00
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
secrets:
|
|
|
|
APT_GPG:
|
|
|
|
required: true
|
|
|
|
APT_USER:
|
|
|
|
required: true
|
|
|
|
APT_PASSWORD:
|
|
|
|
required: true
|
|
|
|
APT_DRAFT:
|
|
|
|
required: true
|
2021-07-14 20:21:29 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
setup:
|
|
|
|
name: Setup APT build
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set APT matrix
|
|
|
|
id: apt-ppa
|
|
|
|
run: |
|
2021-11-17 20:35:28 +01:00
|
|
|
APT=$(jq -n '.include |= [inputs[]]' .github/workflows/apt/*.json --compact-output)
|
2021-07-14 20:21:29 +02:00
|
|
|
echo "::set-output name=apt::$APT"
|
|
|
|
outputs:
|
|
|
|
apt-matrix: ${{ steps.apt-ppa.outputs.apt }}
|
|
|
|
|
|
|
|
build:
|
|
|
|
name: ${{ matrix.description }}
|
|
|
|
needs: [setup]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix: ${{ fromJson(needs.setup.outputs.apt-matrix) }}
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
submodules: true
|
|
|
|
|
2021-10-17 13:29:20 +02:00
|
|
|
- name: Generate environment variables
|
2021-10-16 13:54:18 +02:00
|
|
|
run: |
|
|
|
|
tr -d '\n' < .version > temp && mv temp .version
|
2021-10-17 13:29:20 +02:00
|
|
|
VERSION=$(cat .version)
|
|
|
|
echo VERSION=${VERSION} >> $GITHUB_ENV
|
2021-12-13 20:07:45 +01:00
|
|
|
if [[ $VERSION == *"-"* ]]; then
|
|
|
|
echo STANDARDS_VERSION=$(echo ${VERSION%-*}) >> $GITHUB_ENV
|
|
|
|
echo TARBALL_VERSION=$(echo ${VERSION%-*}) >> $GITHUB_ENV
|
|
|
|
echo DEBIAN_FORMAT='3.0 (quilt)' >> $GITHUB_ENV
|
|
|
|
else
|
|
|
|
echo STANDARDS_VERSION=$(echo ${VERSION%+*}) >> $GITHUB_ENV
|
|
|
|
echo TARBALL_VERSION=${VERSION}~$(echo ${{ matrix.distribution }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
|
|
|
|
echo DEBIAN_FORMAT='3.0 (native)' >> $GITHUB_ENV
|
|
|
|
fi
|
2021-10-17 13:29:20 +02:00
|
|
|
echo DISTRIBUTION=$(echo ${{ matrix.distribution }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
|
2021-10-16 13:54:18 +02:00
|
|
|
|
2021-07-14 20:21:29 +02:00
|
|
|
- name: Build package
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
mkdir -p "${GITHUB_WORKSPACE}/deploy"
|
|
|
|
docker run --rm \
|
|
|
|
-v "${GITHUB_WORKSPACE}/deploy:/deploy" \
|
|
|
|
-v "${GITHUB_WORKSPACE}:/source:rw" \
|
2021-10-17 13:29:20 +02:00
|
|
|
ghcr.io/hyperion-project/${{ matrix.architecture }}:${{ env.DISTRIBUTION }} \
|
2021-07-14 20:21:29 +02:00
|
|
|
/bin/bash -c "cd /source && \
|
2021-12-13 20:07:45 +01:00
|
|
|
mkdir -p debian/source && echo '${{ env.DEBIAN_FORMAT }}' > debian/source/format && \
|
2021-10-17 13:29:20 +02:00
|
|
|
dch --create --distribution ${{ env.DISTRIBUTION }} --package 'hyperion' -v '${{ env.VERSION }}~${{ env.DISTRIBUTION }}' '${{ github.event.commits[0].message }}' && \
|
2021-07-14 20:21:29 +02:00
|
|
|
cp -fr LICENSE debian/copyright && \
|
2021-10-17 13:29:20 +02:00
|
|
|
sed 's/@BUILD_DEPENDS@/${{ matrix.build-depends }}/g; s/@DEPENDS@/${{ matrix.package-depends }}/g; s/@ARCHITECTURE@/${{ matrix.architecture }}/g; s/@STANDARDS_VERSION@/${{ env.STANDARDS_VERSION }}/g' debian/control.in > debian/control && \
|
2021-11-17 20:35:28 +01:00
|
|
|
sed 's/@CMAKE_ENVIRONMENT@/${{ matrix.cmake-environment }}/g' debian/rules.in > debian/rules && \
|
2021-12-13 20:07:45 +01:00
|
|
|
tar -cJf ../hyperion_${{ env.TARBALL_VERSION }}.orig.tar.xz . && \
|
2021-07-14 20:21:29 +02:00
|
|
|
debuild --no-lintian -uc -us && \
|
|
|
|
cp ../hyperion_* /deploy"
|
|
|
|
|
|
|
|
- name: Upload package artifact
|
|
|
|
if: startsWith(github.event.ref, 'refs/tags')
|
2021-10-08 22:29:58 +02:00
|
|
|
uses: actions/upload-artifact@v2
|
2021-07-14 20:21:29 +02:00
|
|
|
with:
|
|
|
|
path: deploy
|
|
|
|
retention-days: 1
|
|
|
|
|
|
|
|
publish:
|
|
|
|
name: Publish APT packages
|
|
|
|
if: startsWith(github.event.ref, 'refs/tags')
|
|
|
|
needs: [setup, build]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Import GPG key
|
|
|
|
uses: crazy-max/ghaction-import-gpg@v3.1.0
|
|
|
|
with:
|
|
|
|
gpg-private-key: ${{ secrets.APT_GPG }}
|
|
|
|
|
|
|
|
- name: Install reprepro
|
|
|
|
run: sudo apt -y install reprepro
|
|
|
|
|
|
|
|
- name: Make build folders, export public GPG key and copy distributions file
|
|
|
|
run: |
|
|
|
|
mkdir -p apt/{conf,dists,db}
|
|
|
|
gpg --armor --output apt/hyperion.pub.key --export 'admin@hyperion-project.org'
|
|
|
|
cp debian/distributions apt/conf/distributions
|
|
|
|
|
|
|
|
- name: Create initial structure/packages files and symbolic links
|
|
|
|
run: |
|
|
|
|
reprepro -Vb apt createsymlinks
|
|
|
|
reprepro -Vb apt export
|
|
|
|
|
|
|
|
- name: Download artifacts
|
|
|
|
uses: actions/download-artifact@v2.0.10
|
|
|
|
|
|
|
|
- name: Include artifacts into the package source
|
|
|
|
run: |
|
2021-11-21 14:26:17 +01:00
|
|
|
for file in artifact/hyperion_*.deb; do
|
2021-07-14 20:21:29 +02:00
|
|
|
if [ -f "$file" ]; then
|
|
|
|
dist=${file#*~}
|
|
|
|
dist=${dist%_*}
|
|
|
|
reprepro -Vb apt/ includedeb "$dist" "$file"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2021-10-08 22:29:58 +02:00
|
|
|
- name: Upload packages to APT server (DRAFT)
|
|
|
|
uses: SamKirkland/FTP-Deploy-Action@4.1.0
|
2021-07-14 20:21:29 +02:00
|
|
|
with:
|
|
|
|
server: apt.hyperion-project.org
|
|
|
|
username: ${{ secrets.APT_USER }}
|
|
|
|
password: ${{ secrets.APT_PASSWORD }}
|
|
|
|
local-dir: "./apt/"
|
2021-10-08 22:29:58 +02:00
|
|
|
server-dir: ${{ secrets.APT_DRAFT }}
|
|
|
|
dangerous-clean-slate: true
|