mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
110 lines
3.9 KiB
YAML
110 lines
3.9 KiB
YAML
name: Hyperion APT Build
|
|
on: [workflow_call]
|
|
|
|
jobs:
|
|
setup:
|
|
name: Setup APT build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Set APT matrix
|
|
id: apt-ppa
|
|
run: |
|
|
APT=$(echo $(cat .github/workflows/apt.json) | jq --compact-output .)
|
|
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
|
|
|
|
- name: Extract major.minor.patch from file .version
|
|
run: |
|
|
tr -d '\n' < .version > temp && mv temp .version
|
|
VERSION=$(tr -d '\n' < .version)
|
|
echo "MAJOR_MINOR_PATCH=$(echo "${VERSION%.*}.$((${VERSION##*.}))")" >> $GITHUB_ENV
|
|
|
|
- name: Build package
|
|
shell: bash
|
|
run: |
|
|
mkdir -p "${GITHUB_WORKSPACE}/deploy"
|
|
docker run --rm \
|
|
-v "${GITHUB_WORKSPACE}/deploy:/deploy" \
|
|
-v "${GITHUB_WORKSPACE}:/source:rw" \
|
|
ghcr.io/hyperion-project/${{ matrix.architecture }}:$(echo ${{ matrix.distribution }} | tr '[:upper:]' '[:lower:]') \
|
|
/bin/bash -c "cd /source && \
|
|
mkdir -p debian/source && echo '3.0 (quilt)' > debian/source/format && \
|
|
dch --create --distribution $(echo ${{ matrix.distribution }} | tr '[:upper:]' '[:lower:]') --package 'hyperion' -v '$(cat .version)~$(echo ${{ matrix.distribution }} | tr '[:upper:]' '[:lower:]')' '${{ github.event.commits[0].message }}' && \
|
|
cp -fr LICENSE debian/copyright && \
|
|
sed 's/@BUILD_DEPENDS@/${{ matrix.build-depends }}/g; s/@DEPENDS@/${{ matrix.package-depends }}/g; s/@ARCHITECTURE@/${{ matrix.architecture }}/g; s/@STANDARDS_VERSION@/${{ env.MAJOR_MINOR_PATCH }}/g' debian/control.in > debian/control && \
|
|
tar -cJf ../hyperion_$(cat .version)~$(echo ${{ matrix.distribution }} | tr '[:upper:]' '[:lower:]').orig.tar.xz . && \
|
|
debuild --no-lintian -uc -us && \
|
|
cp ../hyperion_* /deploy"
|
|
|
|
- name: Upload package artifact
|
|
if: startsWith(github.event.ref, 'refs/tags')
|
|
uses: actions/upload-artifact@v2
|
|
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: |
|
|
for file in artifact/*.deb; do
|
|
if [ -f "$file" ]; then
|
|
dist=${file#*~}
|
|
dist=${dist%_*}
|
|
reprepro -Vb apt/ includedeb "$dist" "$file"
|
|
fi
|
|
done
|
|
|
|
- name: Upload packages to APT server (DRAFT)
|
|
uses: SamKirkland/FTP-Deploy-Action@4.1.0
|
|
with:
|
|
server: apt.hyperion-project.org
|
|
username: ${{ secrets.APT_USER }}
|
|
password: ${{ secrets.APT_PASSWORD }}
|
|
local-dir: "./apt/"
|
|
server-dir: ${{ secrets.APT_DRAFT }}
|
|
dangerous-clean-slate: true
|