2023-10-15 20:40:13 +02:00

112 lines
3.5 KiB
YAML

name: 🌑️ Nightly builds
# Create nightly builds at the end of every day
on:
schedule:
- cron: '0 0 * * *'
jobs:
###############################################
###### rpi_ws281x submodule update check ######
###############################################
update_submodule:
name: 🔁 Update Submodule rpi_ws281x (Nightly build only)
if: ${{ github.repository == 'hyperion-project' && inputs.nightly }}
runs-on: ubuntu-latest
steps:
- name: ⬇ Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
submodules: recursive
- name: 🔁 Update Submodule rpi_ws281x
id: update
run: git submodule update --remote --recursive dependencies/external/rpi_ws281x
- name: ✅ Check git status
id: status
run: echo "status=$(git status -s)" >> $GITHUB_OUTPUT
- name: ✏️ Add/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
git commit -am "Update submodule rpi_ws281x"
- name: 📦 Push changes
if: ${{ env.SECRET_BOT_TOKEN != null && steps.status.outputs.status }}
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.HYPERION_BOT_TOKEN }}
branch: ${{ github.ref }}
env:
SECRET_BOT_TOKEN: ${{ secrets.HYPERION_BOT_TOKEN }}
##################################
###### APT/DNF commit check ######
##################################
check:
name: 🔀 Compare local <-> nightly (Nightly build only)
needs: [update_submodule]
if: ${{ github.repository == 'hyperion-project' && inputs.nightly }}
runs-on: ubuntu-latest
steps:
- name: ⬇ Checkout
uses: actions/checkout@v3
- name: ✅ Check if commit has changed (APT)
id: apt-build-necessary
run: |
if wget --spider "https://nightly.apt.releases.hyperion-project.org//$(git rev-parse --short HEAD)" 2>/dev/null; then
echo "commit-has-changed=false" >> $GITHUB_OUTPUT
else
echo "commit-has-changed=true" >> $GITHUB_OUTPUT
fi
- name: ✅ Check if commit has changed (DNF)
id: dnf-build-necessary
run: |
if wget --spider "https://nightly.dnf.releases.hyperion-project.org/$(git rev-parse --short HEAD)" 2>/dev/null; then
echo "commit-has-changed=false" >> $GITHUB_OUTPUT
else
echo "commit-has-changed=true" >> $GITHUB_OUTPUT
fi
outputs:
build-apt-nightly: ${{ steps.apt-build-necessary.outputs.commit-has-changed }}
build-dnf-nightly: ${{ steps.dnf-build-necessary.outputs.commit-has-changed }}
###################################
###### APT reusable workflow ######
###################################
apt_build:
name: 👷 APT Build
needs: [check]
if: ${{ needs.check.outputs.build-apt-nightly == 'true' }}
uses: ./.github/workflows/apt.yml
secrets: inherit
with:
nightly: true
publish: true
###################################
###### DNF reusable workflow ######
###################################
dnf_build:
name: 👷 DNF Build
needs: [check]
if: ${{ needs.check.outputs.build-dnf-nightly == 'true' }}
uses: ./.github/workflows/dnf.yml
secrets: inherit
with:
nightly: true
publish: true