Monitor and Build MythTV #124
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: "Monitor and Build MythTV" | |
on: # yamllint disable-line rule:truthy | |
schedule: | |
- cron: '0 0 * * 0' | |
workflow_dispatch: # workflow_dispatch allows this to be triggered manually | |
inputs: | |
text_to_print: | |
description: 'Manual trigger' | |
jobs: | |
check-mythtv: | |
runs-on: 'macos-latest' | |
env: | |
MASTER_BRANCH: "master" | |
UPDATE_MASTER: false | |
FIXES_BRANCH: "fixes/34" | |
UPDATE_FIXES: false | |
outputs: | |
MASTER_BRANCH: ${{ env.MASTER_BRANCH }} | |
MASTER_VERS_NUM: ${{ env.MASTER_VERS_NUM }} | |
UPDATE_MASTER: ${{ env.UPDATE_MASTER }} | |
FIXES_BRANCH: ${{ env.FIXES_BRANCH }} | |
FIXES_VERS_NUM: ${{ env.FIXES_VERS_NUM }} | |
UPDATE_FIXES: ${{ env.UPDATE_FIXES }} | |
steps: | |
- uses: actions/checkout@master | |
- name: "Setup environmental variables" | |
run: | | |
echo "GIT_CACHE_DIR=$HOME/mythtv" >> $GITHUB_ENV | |
- name: "Setup Mythtv Repo Cache" | |
id: cache | |
env: | |
cache-name: mythtv | |
uses: actions/cache@master | |
with: | |
path: ${{ env.GIT_CACHE_DIR }} | |
key: mythtv-git-${{ github.sha }} | |
restore-keys: mythtv-git- | |
- name: "Check for mythtv git repository updates" | |
id: gitcheck | |
run: | | |
MASTER_CACHE_DIR=$GIT_CACHE_DIR/${MASTER_BRANCH} | |
FIXES_CACHE_DIR=$GIT_CACHE_DIR/${FIXES_BRANCH} | |
# check on master | |
if [ ! -d "$MASTER_CACHE_DIR" ]; then | |
echo "Master: First time run or cache was deleted" | |
mkdir -p "$MASTER_CACHE_DIR" | |
cd $MASTER_CACHE_DIR | |
git clone -b "$MASTER_BRANCH" https://github.com/MythTV/mythtv.git | |
UPDATE_MASTER="true" | |
else | |
cd "$MASTER_CACHE_DIR/mythtv" | |
MASTER_STATUS=$(git pull) | |
if [[ $MASTER_STATUS == *"Already up to date."* ]]; then | |
echo "master was not updated" | |
UPDATE_MASTER=false | |
else | |
echo "master was updated" | |
UPDATE_MASTER="true" | |
fi | |
fi | |
echo "UPDATE_MASTER=$UPDATE_MASTER" >> $GITHUB_ENV | |
# check on fixes | |
if [ ! -d "FIXES_CACHE_DIR" ]; then | |
echo "Fixes: First time run, a new version was released, or cache was deleted" | |
sudo rm -Rf ${GIT_CACHE_DIR/fixes*} | |
mkdir -p "$FIXES_CACHE_DIR" | |
cd $FIXES_CACHE_DIR | |
git clone -b "$FIXES_BRANCH" https://github.com/MythTV/mythtv.git | |
UPDATE_FIXES="true" | |
else | |
cd "$FIXES_CACHE_DIR/mythtv" | |
FIXES_STATUS=$(git pull) | |
if [[ $FIXES_STATUS == *"Already up to date."* ]]; then | |
echo "fixes was not updated" | |
UPDATE_FIXES=false | |
else | |
echo "fixes was updated" | |
UPDATE_FIXES="true" | |
fi | |
fi | |
echo "UPDATE_FIXES=$UPDATE_FIXES" >> $GITHUB_ENV | |
build-mythtv-master: | |
needs: check-mythtv | |
if: needs.check-mythtv.outputs.UPDATE_MASTER == 'true' | |
uses: ./.github/workflows/build_sign_upload.yml | |
with: | |
USE_CCACHE: true | |
MYTHBRANCH: ${{ needs.check-mythtv.outputs.MASTER_BRANCH }} | |
PKGMGR: macports | |
secrets: inherit | |
build-mythtv-fixes: | |
needs: check-mythtv | |
if: needs.check-mythtv.outputs.UPDATE_FIXES == 'true' | |
uses: ./.github/workflows/build_sign_upload.yml | |
with: | |
USE_CCACHE: true | |
MYTHBRANCH: ${{ needs.check-mythtv.outputs.FIXES_BRANCH }} | |
PKGMGR: macports | |
secrets: inherit |