2021-10-08 22:29:58 +02:00
|
|
|
name: Nightly build
|
|
|
|
|
|
|
|
# Create nightly builds at the end of every day
|
|
|
|
on:
|
|
|
|
schedule:
|
|
|
|
- cron: '0 0 * * *'
|
2022-09-06 09:48:36 +02:00
|
|
|
repository_dispatch:
|
2022-11-06 22:41:23 +01:00
|
|
|
types: [hyperion_nightly_push]
|
2021-10-08 22:29:58 +02:00
|
|
|
|
|
|
|
jobs:
|
2022-03-08 20:19:01 +01:00
|
|
|
update:
|
2022-03-09 17:40:29 +01:00
|
|
|
name: Update Submodule rpi_ws281x
|
2022-03-08 20:19:01 +01:00
|
|
|
if: github.repository_owner == 'hyperion-project'
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-08-01 16:21:13 +02:00
|
|
|
- uses: actions/checkout@v3
|
2022-03-08 20:19:01 +01:00
|
|
|
with:
|
|
|
|
persist-credentials: false
|
|
|
|
fetch-depth: 0
|
|
|
|
submodules: recursive
|
|
|
|
|
2022-03-09 17:40:29 +01:00
|
|
|
- name: Update Submodule rpi_ws281x
|
2022-03-08 20:19:01 +01:00
|
|
|
id: update
|
2022-03-09 17:40:29 +01:00
|
|
|
run: git submodule update --remote --recursive dependencies/external/rpi_ws281x
|
2022-03-08 20:19:01 +01:00
|
|
|
|
|
|
|
- name: Check git status
|
|
|
|
id: status
|
2022-11-06 22:41:23 +01:00
|
|
|
run: echo "status=$(git status -s)" >> $GITHUB_OUTPUT
|
2022-03-08 20:19:01 +01:00
|
|
|
|
|
|
|
- name: Add and commit changes
|
|
|
|
if: ${{ steps.status.outputs.status }}
|
|
|
|
run: |
|
|
|
|
git config --local user.email "20935312+Hyperion-Bot@users.noreply.github.com"
|
|
|
|
git config --local user.name "Hyperion-Bot"
|
|
|
|
git config --local diff.ignoreSubmodules dirty
|
2022-03-09 17:40:29 +01:00
|
|
|
git commit -am "Update submodule rpi_ws281x"
|
2022-03-08 20:19:01 +01:00
|
|
|
|
|
|
|
- name: Push changes
|
|
|
|
if: ${{ steps.status.outputs.status }}
|
|
|
|
uses: ad-m/github-push-action@master
|
|
|
|
with:
|
|
|
|
github_token: ${{ secrets.HYPERION_BOT_TOKEN }}
|
|
|
|
branch: ${{ github.ref }}
|
|
|
|
|
2021-10-09 13:10:55 +02:00
|
|
|
check:
|
|
|
|
name: Compare local <-> nightly
|
2022-03-08 20:19:01 +01:00
|
|
|
needs: [update]
|
2021-10-10 12:24:03 +02:00
|
|
|
if: github.repository_owner == 'hyperion-project'
|
2021-10-09 13:10:55 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-08-01 16:21:13 +02:00
|
|
|
- uses: actions/checkout@v3
|
2021-10-09 13:10:55 +02:00
|
|
|
- name: Check if commit has changed
|
|
|
|
id: build-necessary
|
|
|
|
run: |
|
2021-10-26 19:55:33 +02:00
|
|
|
if wget --spider "https://nightly.apt.hyperion-project.org/$(git rev-parse --short HEAD)" 2>/dev/null; then
|
2022-11-06 22:41:23 +01:00
|
|
|
echo "commit-has-changed=false" >> $GITHUB_OUTPUT
|
2021-10-09 13:10:55 +02:00
|
|
|
else
|
2022-11-06 22:41:23 +01:00
|
|
|
echo "commit-has-changed=true" >> $GITHUB_OUTPUT
|
2021-10-09 13:10:55 +02:00
|
|
|
fi
|
|
|
|
outputs:
|
|
|
|
build-nightly: ${{ steps.build-necessary.outputs.commit-has-changed }}
|
|
|
|
|
2021-10-08 22:29:58 +02:00
|
|
|
setup:
|
|
|
|
name: Setup nightly build
|
2021-10-09 13:10:55 +02:00
|
|
|
needs: [check]
|
|
|
|
if: ${{ needs.check.outputs.build-nightly == 'true' }}
|
2021-10-08 22:29:58 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-08-01 16:21:13 +02:00
|
|
|
- uses: actions/checkout@v3
|
2021-10-09 13:31:07 +02:00
|
|
|
- name: Set nightly matrix
|
|
|
|
id: nightly-ppa
|
2021-10-08 22:29:58 +02:00
|
|
|
run: |
|
2022-11-06 22:41:23 +01:00
|
|
|
NIGHTLY=$(jq -n '.include |= [ inputs[] | select(.["exclude"] != true)]' .github/workflows/apt/*.json --compact-output)
|
|
|
|
echo "nightly=$NIGHTLY" >> $GITHUB_OUTPUT
|
|
|
|
|
2021-10-08 22:29:58 +02:00
|
|
|
outputs:
|
2021-10-09 13:31:07 +02:00
|
|
|
nightly-matrix: ${{ steps.nightly-ppa.outputs.nightly }}
|
2021-10-08 22:29:58 +02:00
|
|
|
|
|
|
|
build:
|
|
|
|
name: ${{ matrix.description }}
|
|
|
|
needs: [setup]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
2021-10-09 13:31:07 +02:00
|
|
|
matrix: ${{ fromJson(needs.setup.outputs.nightly-matrix) }}
|
2021-10-08 22:29:58 +02:00
|
|
|
|
|
|
|
steps:
|
2022-08-01 16:21:13 +02:00
|
|
|
- uses: actions/checkout@v3
|
2021-10-08 22:29:58 +02:00
|
|
|
with:
|
2023-07-29 19:28:51 +02:00
|
|
|
submodules: recursive
|
2021-10-08 22:29:58 +02:00
|
|
|
|
2021-10-17 13:29:20 +02:00
|
|
|
- name: Generate environment variables
|
2021-10-08 22:29:58 +02:00
|
|
|
run: |
|
2021-10-17 13:29:20 +02:00
|
|
|
echo "$(tr -d '\n' < .version)+nightly$(date '+%Y%m%d')$(git rev-parse --short HEAD)" > .version
|
|
|
|
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
|
2022-09-07 08:12:13 +02:00
|
|
|
echo TARBALL_VERSION=$(echo ${VERSION%-*}) >> $GITHUB_ENV
|
2021-12-13 20:07:45 +01:00
|
|
|
echo DEBIAN_FORMAT='3.0 (quilt)' >> $GITHUB_ENV
|
|
|
|
else
|
|
|
|
echo STANDARDS_VERSION=$(echo ${VERSION%+*}) >> $GITHUB_ENV
|
2022-09-07 08:12:13 +02:00
|
|
|
echo TARBALL_VERSION=${VERSION}~$(echo ${{ matrix.distribution }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
|
2021-12-13 20:07:45 +01:00
|
|
|
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-08 22:29:58 +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-10-08 22:29:58 +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-10-08 22:29:58 +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-18 17:18:34 +01:00
|
|
|
sed 's/@CMAKE_ENVIRONMENT@/${{ matrix.cmake-environment }}/g' debian/rules.in > debian/rules && \
|
2022-09-07 08:12:13 +02:00
|
|
|
tar -cJf ../hyperion_${{ env.TARBALL_VERSION }}.orig.tar.xz . && \
|
2021-10-08 22:29:58 +02:00
|
|
|
debuild --no-lintian -uc -us && \
|
2022-09-06 09:48:36 +02:00
|
|
|
cp ../hyperion_*.deb /deploy"
|
2021-10-08 22:29:58 +02:00
|
|
|
|
|
|
|
- name: Upload package artifact
|
2022-08-01 16:21:24 +02:00
|
|
|
uses: actions/upload-artifact@v3
|
2021-10-08 22:29:58 +02:00
|
|
|
with:
|
|
|
|
path: deploy
|
|
|
|
retention-days: 1
|
|
|
|
|
|
|
|
publish:
|
|
|
|
name: Publish nightly packages
|
|
|
|
needs: [setup, build]
|
2022-11-06 22:41:23 +01:00
|
|
|
if: github.repository_owner == 'hyperion-project'
|
2021-10-08 22:29:58 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2022-08-01 16:21:13 +02:00
|
|
|
uses: actions/checkout@v3
|
2021-10-08 22:29:58 +02:00
|
|
|
|
|
|
|
- name: Import GPG key
|
2023-06-11 20:42:35 +02:00
|
|
|
uses: crazy-max/ghaction-import-gpg@v5.3.0
|
2021-10-08 22:29:58 +02:00
|
|
|
with:
|
2022-07-25 07:44:10 +02:00
|
|
|
gpg_private_key: ${{ secrets.APT_GPG }}
|
2021-10-08 22:29:58 +02:00
|
|
|
|
|
|
|
- name: Install reprepro
|
|
|
|
run: sudo apt -y install reprepro
|
|
|
|
|
2021-10-09 13:10:55 +02:00
|
|
|
- name: Make build folders, export public GPG key, copy distributions file and create short sha file for nightly build check
|
2021-10-08 22:29:58 +02:00
|
|
|
run: |
|
2021-10-09 13:10:55 +02:00
|
|
|
mkdir -p nightly/{conf,dists,db}
|
|
|
|
gpg --armor --output nightly/hyperion.pub.key --export 'admin@hyperion-project.org'
|
|
|
|
cp debian/distributions nightly/conf/distributions
|
|
|
|
touch "nightly/$(git rev-parse --short HEAD)"
|
2021-10-08 22:29:58 +02:00
|
|
|
|
|
|
|
- name: Create initial structure/packages files and symbolic links
|
|
|
|
run: |
|
2021-10-09 13:10:55 +02:00
|
|
|
reprepro -Vb nightly createsymlinks
|
|
|
|
reprepro -Vb nightly export
|
2021-10-08 22:29:58 +02:00
|
|
|
|
|
|
|
- name: Download artifacts
|
2023-02-02 19:15:29 +01:00
|
|
|
uses: actions/download-artifact@v3.0.2
|
2021-10-08 22:29:58 +02:00
|
|
|
|
|
|
|
- name: Include artifacts into the package source
|
|
|
|
run: |
|
|
|
|
for file in artifact/*.deb; do
|
|
|
|
if [ -f "$file" ]; then
|
|
|
|
dist=${file#*~}
|
|
|
|
dist=${dist%_*}
|
2021-10-09 13:10:55 +02:00
|
|
|
reprepro -Vb nightly/ includedeb "$dist" "$file"
|
2021-10-08 22:29:58 +02:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2021-10-17 13:29:20 +02:00
|
|
|
- name: Upload packages to nightly server
|
2023-04-05 17:25:49 +02:00
|
|
|
uses: SamKirkland/FTP-Deploy-Action@v4.3.4
|
2021-10-08 22:29:58 +02:00
|
|
|
with:
|
2021-10-26 19:55:33 +02:00
|
|
|
server: nightly.apt.hyperion-project.org
|
2021-10-09 13:10:55 +02:00
|
|
|
username: ${{ secrets.NIGHTLY_USER }}
|
|
|
|
password: ${{ secrets.NIGHTLY_PASSWORD }}
|
|
|
|
local-dir: "./nightly/"
|
|
|
|
server-dir: "./"
|
2021-10-08 22:29:58 +02:00
|
|
|
dangerous-clean-slate: true
|
|
|
|
|
|
|
|
- name: Remove intermediate artifacts
|
2022-11-07 20:11:39 +01:00
|
|
|
uses: geekyeggo/delete-artifact@v2
|
2021-10-08 22:29:58 +02:00
|
|
|
with:
|
|
|
|
name: artifact
|
|
|
|
failOnError: false
|