1
0
mirror of synced 2026-01-24 03:36:36 +00:00
Frank Halasz 1ffcde195a
Automate HCFILES workflow (also add "up one level" button to index.html pages) (#1784)
* First pass at workflow for doing HCFILES on each release

* Finish doHCFILES workflow

* Fix delete of gh-page branch in DoHCFILES workflow

* Redo doHCFILES workflow for files.interlisp.org; add indexing to do_hcfiles script

* Fiddling with workflow names so that I can test doHCFILES.yml on a branch

* in doHCFILES workflow fix use of GH_TOKEN

* Fix typo in doHCFILES workflow

* Debugging doHCFILES workflow

* Fix multiple bugs in do_hcfiles script; fixed multiple bugs in doHCFILES workflow

* Debugging move

* in do_hcfiles.sh add back in Tedit file stoHCFILES run

* Clean up do_hcfiles.sh a bit

* Add debugging code to doHCFILES workflow

* In MAKE-INDEX-HTMLS, add code to ensure that the original case of the files/directory names are preserved since (DIRECTORY) seems to return names ia all-caps, always

* Debugging doHCFILES

* Fiddling with debugging code in doHCFILES workflow

* Add MEDLEY-INIT-VARS to cm file in do_hcfiles.sh

* Undo effect of merging fgh_hcfiles-updates into fgh_hcfiles-workflow.  fgh_hcfiles-update will be abadoned

* Add up button to index.html files in MAKE-INDEX-HTMLS

* Update MAKE-INDEX-HTMLS to include an up-on-level button in index.html files.  Move fio files to medley instead of source.  Streamline doHCFILES workflow

* Debugging

* In MAKE-INDEX-HTMLS, make sure that the up-one button does not appear in the top-level index.html

* In doHCFILES workflow, add difference between development(draft) and production; add doHCFILES workflow into buildReleraseInclDocker workflow

* Update MAKE-INDEX-HTMLS with new onclick script to handle directories properly

* Fix typo in buildRelease workflow

* Polishing up do_hcfiles.sh

* Return buildDocker.yml to original state after using it to test doHCFILES.yml
2024-07-15 05:56:53 -07:00

140 lines
4.1 KiB
YAML

#*******************************************************************************
# doHCFILES.yml
#
# Interlisp workflow to run HCFILES. HCFILES prints out PDF files for all of the
# files in the Medley directory and posts them on files.interlisp.org.
#
# This workflow is designed to be kickjed off by the buildReleaseInclDocker
# workflow running in the Medley repo, once the release has been completed successfully
#
# Copyright 2024 by Interlisp.org
#
# ******************************************************************************
name: Run HCFILES
# Run this workflow on ...
on:
workflow_dispatch:
inputs:
draft:
description: "Mark this as a draft release"
type: choice
options:
- 'false'
- 'true'
workflow_call:
inputs:
draft:
description: "Mark this as a draft release"
required: false
type: string
default: 'false'
secrets:
OIO_SSH_KEY:
required: true
MU_TOKEN:
required: true
defaults:
run:
shell: bash
jobs:
run_HCFILES:
runs-on: ubuntu-latest
steps:
- name: Checkout Medley repo
uses: actions/checkout@v4
- name: Checkout notecards
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/notecards
path: ./notecards
- name: Checkout loops
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/loops
path: ./loops
- name: Checkout test
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/test
path: ./test
- name: Cleanup .git for notecards, loops, test
run: rm -rf ./notecards/.git ./loops/.git ./test/.git
- name: Download Maiko
run: |
gh release download --output /tmp/maiko.tgz \
--repo ${{ github.repository_owner }}/maiko \
--pattern '*-linux.x86_64.tgz'
tar -xzf /tmp/maiko.tgz
env:
GH_TOKEN: ${{ secrets.MU_TOKEN }}
- name: Install vnc & ghostscript (ps2pdf)
run: |
sudo apt-get update
sudo apt-get install -y tightvncserver
sudo apt-get install -y ghostscript
- name: Build apps.sysout
run: |
Xvnc -geometry 1280x720 :0 &
export DISPLAY=":0"
scripts/loadup-all.sh -apps
- name: Run HCFILES
run: |
export DISPLAY=":0"
scripts/do_hcfiles.sh
- name: Push Medley files (including created pdf files) to files.interlisp.org
run: |
# create a tar file of all of the directories to be pushed
tarfile=/tmp/source-$$.tgz
tar -c -z -f ${tarfile} --exclude=.git .
# set up ssh identity
eval $(ssh-agent)
ssh-add - <<< "${SSH_KEY}"
# set destination directory on files.interlisp.org
if [ "${{ inputs.draft }}" = "true" ]
then
dest=/srv/oio/files/development/medley
else
dest=/srv/oio/files/production/medley
fi
# Push tar file up to files.interlisp.org
batchfile=/tmp/batch-$$
echo "-put ${tarfile} ${dest}.tgz" > ${batchfile}
sftp -o StrictHostKeyChecking=no -b ${batchfile} ubuntu@files.interlisp.org
# now tar is up, untar it and juggle backups
scriptfile=/tmp/script-$$
# create script file to do the work
cat > ${scriptfile} <<EOF
rm -rf ${dest}.new
mkdir -p ${dest}.new
tar -C ${dest}.new -x -z -f ${dest}.tgz
rm -f ${dest}.tgz
rm -rf ${dest}.oldold
if [ -e ${dest}.old ]; then mv ${dest}.old ${dest}.oldold; fi
if [ -e ${dest} ]; then mv ${dest} ${dest}.old; fi
mv ${dest}.new ${dest}
EOF
# execute the script file via ssh
ssh -aTxo BatchMode=yes ubuntu@files.interlisp.org /bin/sh -s < ${scriptfile}
env:
SSH_KEY: ${{ secrets.OIO_SSH_KEY }}