Skip to content

livecd_builder

livecd_builder #323

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: livecd_builder
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
schedule:
- cron: '0 3 2,16 * *'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
name: Build livecd
# The type of runner that the job will run on
if: ${{ github.event_name != 'push' || !contains(github.event.head_commit.message, '[skip ci]') }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
LIVECD_PROFILE:
- ultralite
- default
- xfce
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
if: ${{ github.event_name != 'push' || !contains(github.event.head_commit.message, format('[skip {0}]', matrix.LIVECD_PROFILE)) }}
with:
ref: master
# install deps
- name: Install deps
if: ${{ github.event_name != 'push' || !contains(github.event.head_commit.message, format('[skip {0}]', matrix.LIVECD_PROFILE)) }}
shell: bash
run: |
sudo apt update -qq
sudo apt install -y tree rsync openssh-client qemu-user-static
# Runs a single command using the runners shell
- name: Run makelivecd script
if: ${{ github.event_name != 'push' || !contains(github.event.head_commit.message, format('[skip {0}]', matrix.LIVECD_PROFILE)) }}
shell: bash
env:
LIVECD_PROFILE: ${{ matrix.LIVECD_PROFILE }}
run: sudo LIVECD_PROFILE="$LIVECD_PROFILE" bash makelivecd.sh
# Runs a set of commands using the runners shell
# upload files
- name: Upload files
if: ${{ github.event_name != 'push' || !contains(github.event.head_commit.message, format('[skip {0}]', matrix.LIVECD_PROFILE)) }}
env:
LIVECD_PROFILE: ${{ matrix.LIVECD_PROFILE }}
RSYNC_HOST: ${{ secrets.HOST }}
RSYNC_PATH: ${{ secrets.PATH }}
KNOWN_HOST: ${{ secrets.KNOWN_HOST }}
SSHPRIVKEY: ${{ secrets.KEY }}
shell: bash
run: |
cd root.x86_64/livecd/releng
sudo chown -R $UID upload
sudo chown $UID .
tree -a upload || true
echo "Setting up KNOWN_HOST..."
echo "$KNOWN_HOST" > ~/kh
echo "Setting up PRIV_KEY ..."
trap "shred -v ~/key ~/kh" ERR EXIT
echo "$SSHPRIVKEY" |base64 -d > ~/key
chmod 0600 ~/key
echo "ASSERTING ..."
[ -n "$RSYNC_HOST" ] || (echo RSYNC_HOST is not set; exit 1)
[ -n "$RSYNC_PATH" ] || (echo RSYNC_PATH is not set; exit 1)
[ -n "$KNOWN_HOST" ] || (echo KNOWN_HOST is not set; exit 1)
[ -n "$SSHPRIVKEY" ] || (echo SSHPRIVKEY is not set; exit 1)
echo "Starting Upload ..."
rsync --delete -rlvPh -e "ssh -l ${RSYNC_HOST%@*} -i ~/key -o StrictHostKeyChecking=ask -o UserKnownHostsFile=~/kh" upload/ "${RSYNC_HOST#*@}:${RSYNC_PATH}/${LIVECD_PROFILE}"
keepalive:
name: do keepalive
# The type of runner that the job will run on
needs: [build]
if: ${{ github.event_name != 'push' || !contains(github.event.head_commit.message, '[skip ci]') }}
runs-on: ubuntu-20.04
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
ref: master
- name: keepalive
env:
SSHPRIVKEY: ${{ secrets.KEY }}
shell: bash
run: |
echo "Starting KeepAlive ..."
trap "shred -v ~/key" ERR EXIT
echo "$SSHPRIVKEY" |base64 -d > ~/key
pushd .
mkdir -p ~/.ssh
echo "IdentityFile $(realpath ~/key)" > ~/.ssh/config
ssh -o StrictHostKeyChecking=no [email protected] -T || true
git config user.email "[email protected]"
git config user.name "bot"
git reset --soft HEAD
git commit --allow-empty -m "[skip ci] keepalive at $(date -u +"%Y-%m-%dT%H:%M:%SZ")"
while ! git push origin master; do sleep 10; done
git show --name-only |grep -Fq '[skip ci] keepalive at'
git reset --soft HEAD~1
while ! git push --force origin master; do sleep 10; done
popd