Build/Push Medley Release #194
Workflow file for this run
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
#******************************************************************************* | |
# buidLoadup.yml | |
# | |
# Interlisp workflow to build Medley release and push it to github. This workflow | |
# is platform independent - but runs on Linux/amd64. | |
# | |
# This workflow contains a sentry that causes it to skip the build (as identified | |
# by its commit SHA) if its already been done. Setting the "force" input to true | |
# will bypass this sentry, | |
# | |
# 2022-01-17 Frank Halasz based on an earlier version of buildLoadup for Medley. | |
# | |
# Copyright 2022-2023 by Interlisp.org | |
# | |
# ****************************************************************************** | |
name: Build/Push Medley Release | |
# Run this workflow on ... | |
on: | |
workflow_dispatch: | |
inputs: | |
draft: | |
description: "Mark this as a draft release" | |
type: choice | |
options: | |
- 'false' | |
- 'true' | |
force: | |
description: "Force build even if build already successfully completed for this commit" | |
type: choice | |
options: | |
- 'false' | |
- 'true' | |
workflow_call: | |
outputs: | |
successful: | |
description: "'True' if medley build completed successully" | |
value: ${{ jobs.complete.outputs.build_successful }} | |
inputs: | |
draft: | |
description: "Mark this as a draft release" | |
required: false | |
type: string | |
default: 'false' | |
force: | |
description: "Force build even if build already successfully completed for this commit" | |
required: false | |
type: string | |
default: 'false' | |
secrets: | |
OIO_SSH_KEY: | |
required: true | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
###################################################################################### | |
# Regularize the inputs so they can be referenced the same way whether they are | |
# the result of a workflow_dispatch or a workflow_call | |
inputs: | |
runs-on: ubuntu-latest | |
outputs: | |
draft: ${{ steps.one.outputs.draft }} | |
force: ${{ steps.one.outputs.force }} | |
steps: | |
- id: one | |
run: > | |
if [ '${{ toJSON(inputs) }}' = 'null' ]; | |
then | |
echo "workflow_dispatch"; | |
echo "draft=${{ github.event.inputs.draft }}" >> $GITHUB_OUTPUT; | |
echo "force=${{ github.event.inputs.force }}" >> $GITHUB_OUTPUT; | |
else | |
echo "workflow_call"; | |
echo "draft=${{ inputs.draft }}" >> $GITHUB_OUTPUT; | |
echo "force=${{ inputs.force }}" >> $GITHUB_OUTPUT; | |
fi | |
###################################################################################### | |
# Use sentry-action to determine if this release has already been built | |
# based on the latest commit to the repo | |
sentry: | |
needs: inputs | |
runs-on: ubuntu-latest | |
outputs: | |
release_not_built: ${{ steps.check.outputs.release_not_built }} | |
steps: | |
# Checkout the actions for this repo owner | |
- name: Checkout Actions | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ github.repository_owner }}/.github | |
path: ./Actions_${{ github.sha }} | |
- run: mv ./Actions_${{ github.sha }}/actions ../actions && rm -rf ./Actions_${{ github.sha }} | |
# Check if build already run for this commit | |
- name: Build already completed? | |
id: check | |
continue-on-error: true | |
uses: ./../actions/check-sentry-action | |
with: | |
tag: "loadup" | |
###################################################################################### | |
# | |
# Do the loadup | |
# | |
loadup: | |
runs-on: ubuntu-latest | |
outputs: | |
combined_release_tag: ${{ steps.job_outputs.outputs.COMBINED_RELEASE_TAG }} | |
medley_release_tag: ${{ steps.job_outputs.outputs.MEDLEY_RELEASE_TAG }} | |
medley_short_release_tag: ${{ steps.job_outputs.outputs.MEDLEY_SHORT_RELEASE_TAG }} | |
debs_filename_base: ${{ steps.debs.outputs.DEBS_FILENAME_BASE }} | |
maiko_release_tag: ${{ steps.job_outputs.outputs.MAIKO_RELEASE_TAG }} | |
needs: [inputs, sentry] | |
if: | | |
needs.sentry.outputs.release_not_built == 'true' | |
|| needs.inputs.outputs.force == 'true' | |
steps: | |
# Checkout the actions for this repo owner | |
- name: Checkout Actions | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ github.repository_owner }}/.github | |
path: ./Actions_${{ github.sha }} | |
- run: mv ./Actions_${{ github.sha }}/actions ../actions && rm -rf ./Actions_${{ github.sha }} | |
# Checkout latest commit | |
- name: Checkout Medley | |
uses: actions/checkout@v3 | |
# Setup release tag | |
- name: Setup Release Tag | |
id: tag | |
uses: ./../actions/release-tag-action | |
# Get Maiko release information, retrieves the name of the latest (draft) | |
# release. Used to download the correct Maiko release | |
- name: Get Maiko Release Information | |
id: maiko | |
env: | |
GH_TOKEN: ${{ secrets.MAIKO_TOKEN }} | |
run: | | |
if [ "${{ needs.inputs.outputs.draft }}" = "true" ]; | |
then | |
echo "Include drafts" | |
tag=$(gh release list --repo interlisp/maiko | sed -ne '1,1p' | awk '{ print $1 }') | |
else | |
echo "Exclude drafts" | |
tag=$(gh release list --repo interlisp/maiko --exclude-drafts | sed -ne '1,1p' | awk '{ print $1 }') | |
fi | |
echo "latest_tag=${tag}" >> ${GITHUB_OUTPUT} | |
# Setup environment variables & establish job outputs | |
- name: Setup Environment Variables | |
run: | | |
echo "build_time=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> ${GITHUB_OUTPUT} | |
echo "TARBALL_DIR=installers/deb/tmp/tarballs" >>${GITHUB_ENV} | |
echo "DEBS_DIR=installers/deb/debs" >>${GITHUB_ENV} | |
echo "TARS_DIR=installers/deb/tars" >>${GITHUB_ENV} | |
echo "MEDLEY_RELEASE_TAG=${RELEASE_TAG}" >>${GITHUB_ENV} | |
echo "MAIKO_RELEASE_TAG=${{ steps.maiko.outputs.latest_tag }}" >>${GITHUB_ENV} | |
- name: More Environment Variables | |
run: | | |
echo "MEDLEY_SHORT_RELEASE_TAG=${MEDLEY_RELEASE_TAG#medley-}" >>${GITHUB_ENV} | |
echo "MAIKO_SHORT_RELEASE_TAG=${MAIKO_RELEASE_TAG#maiko-}" >>${GITHUB_ENV} | |
- name: Even More Environment Variables | |
run: | | |
echo "COMBINED_RELEASE_TAG=${MEDLEY_SHORT_RELEASE_TAG}_${MAIKO_SHORT_RELEASE_TAG}" >>${GITHUB_ENV} | |
- name: Establish job outputs | |
id: job_outputs | |
run: | | |
echo "COMBINED_RELEASE_TAG=${COMBINED_RELEASE_TAG}" >> $GITHUB_OUTPUT; | |
echo "MEDLEY_RELEASE_TAG=${MEDLEY_RELEASE_TAG}" >> $GITHUB_OUTPUT; | |
echo "MEDLEY_SHORT_RELEASE_TAG=${MEDLEY_SHORT_RELEASE_TAG}" >> $GITHUB_OUTPUT; | |
echo "MAIKO_RELEASE_TAG=${MAIKO_RELEASE_TAG}" >> $GITHUB_OUTPUT; | |
# Setup some needed dirs in workspace | |
- name: Create work dirs | |
run: mkdir -p ${TARBALL_DIR} | |
# Download Maiko Release Assets | |
- name: Download Release Assets | |
env: | |
GH_TOKEN: ${{ secrets.MAIKO_TOKEN }} | |
run: | | |
gh release download ${{ env.MAIKO_RELEASE_TAG }} --repo interlisp/maiko --pattern "${{ env.MAIKO_RELEASE_TAG }}-linux.*.tgz" --dir "${{ env.TARBALL_DIR }}" | |
- name: Untar Maiko Release for use in loadup | |
run: | | |
tar -xzf "${TARBALL_DIR}/${{ env.MAIKO_RELEASE_TAG }}-linux.x86_64.tgz" | |
# Checkout Notecards and tar it in the tarballsdir | |
- name: Checkout Notecards | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ github.repository_owner }}/notecards | |
path: ./notecards | |
- run: mv ./notecards ../notecards | |
- name: Tar notecards into tarball dir | |
run: | | |
cd .. | |
tar cfz medley/${TARBALL_DIR}/notecards.tgz notecards | |
# Install vnc | |
- name: Install vnc | |
run: sudo apt-get update && sudo apt-get install -y tightvncserver | |
- name: Build Loadup sysouts and databases | |
run: | | |
Xvnc -geometry 1280x720 :0 & | |
export DISPLAY=":0" | |
PATH="$PWD/maiko:$PATH" | |
scripts/loadup-all.sh -apps | |
- name: Build loadups release tar | |
run: | | |
cd .. | |
mkdir -p medley/${TARBALL_DIR} | |
tar cfz medley/${TARBALL_DIR}/${MEDLEY_RELEASE_TAG}-loadups.tgz \ | |
medley/loadups/lisp.sysout \ | |
medley/loadups/full.sysout \ | |
medley/loadups/apps.sysout \ | |
medley/loadups/whereis.hash \ | |
medley/library/exports.all | |
- name: Build runtime release tar | |
run: | | |
cd .. | |
mkdir -p medley/${TARBALL_DIR} | |
tar cfz medley/${TARBALL_DIR}/${MEDLEY_RELEASE_TAG}-runtime.tgz \ | |
--exclude "*~" --exclude "*#*" \ | |
--exclude exports.all \ | |
medley/clos \ | |
medley/docs/dinfo \ | |
medley/docs/man-page/medley.1.gz \ | |
medley/doctools \ | |
medley/greetfiles \ | |
medley/rooms \ | |
medley/medley \ | |
medley/run-medley \ | |
medley/scripts \ | |
medley/fonts/displayfonts \ | |
medley/fonts/altofonts \ | |
medley/fonts/adobe \ | |
medley/fonts/postscriptfonts \ | |
medley/library \ | |
medley/lispusers \ | |
medley/sources \ | |
medley/internal | |
# Build the deb files as well as the tgz files | |
- name: Build .deb files for 3 architectures | |
id: debs | |
run: | | |
cd installers/deb | |
debs_filename_base=$(./build_deb.sh) | |
echo "DEBS_FILENAME_BASE=${debs_filename_base}" >> $GITHUB_ENV; | |
echo "DEBS_FILENAME_BASE=${debs_filename_base}" >> $GITHUB_OUTPUT; | |
# Push the release up to github releases | |
- name: Delete existing release with same tag (if any) | |
uses: cb80/delrel@latest | |
with: | |
tag: ${{ env.MEDLEY_RELEASE_TAG }} | |
continue-on-error: true | |
- name: Push the release | |
id: push_release | |
uses: ncipollo/release-action@v1 | |
with: | |
allowUpdates: true | |
artifacts: | |
${{ env.TARBALL_DIR }}/${{ env.MEDLEY_RELEASE_TAG }}-loadups.tgz, | |
${{ env.TARBALL_DIR }}/${{ env.MEDLEY_RELEASE_TAG }}-runtime.tgz, | |
${{ env.DEBS_DIR }}/*.deb, | |
${{ env.TARS_DIR }}/*.tgz | |
tag: ${{ env.MEDLEY_RELEASE_TAG }} | |
draft: ${{ needs.inputs.outputs.draft }} | |
prerelease: false | |
generateReleaseNotes: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Rename medley tars | |
run: | | |
cd ${{ env.TARS_DIR }} | |
mv medley-full-*-linux-x86_64.tgz medley.tgz | |
- name: Save medley tar for use in cygwin installers | |
uses: actions/upload-artifact@v3 | |
with: | |
name: medley-tar | |
path: | | |
${{ env.TARS_DIR }}/medley.tgz | |
# | |
# Create the Windows installer, push it up to the release on github and | |
# update the downloads page on OIO | |
# | |
windows_installer: | |
runs-on: windows-2022 | |
needs: [inputs, sentry, loadup] | |
if: | | |
needs.sentry.outputs.release_not_built == 'true' | |
|| needs.inputs.outputs.force == 'true' | |
steps: | |
# Checkout latest commit | |
- name: Checkout Medley | |
uses: actions/checkout@v3 | |
# Store the values output from loadup job as environment variables | |
- name: Environment Variables | |
shell: powershell | |
run: | | |
$crt="${{ needs.loadup.outputs.combined_release_tag }}" | |
echo "COMBINED_RELEASE_TAG=$crt" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
$mrt="${{ needs.loadup.outputs.medley_release_tag }}" | |
echo "MEDLEY_RELEASE_TAG=$mrt" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
$msrt="${{ needs.loadup.outputs.medley_short_release_tag }}" | |
echo "MEDLEY_SHORT_RELEASE_TAG=$msrt" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
$debs="${{ needs.loadup.outputs.debs_filename_base }}" | |
echo "DEBS_FILENAME_BASE=$debs" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
# Retrieve medley tars from artifact store | |
- name: Retrieve medley tar | |
uses: actions/download-artifact@v3 | |
with: | |
name: medley-tar | |
path: installers/cygwin/ | |
# Download maiko cygwin build | |
- name: Retrieve maiko cygwin build | |
shell: powershell | |
env: | |
GH_TOKEN: ${{ secrets.MAIKO_TOKEN }} | |
run: | | |
gh release download ${{ needs.loadup.outputs.maiko_release_tag }} --repo interlisp/maiko --pattern ${{ needs.loadup.outputs.maiko_release_tag }}-cygwin.x86_64.tgz --output installers\cygwin\maiko-cygwin.x86_64.tgz | |
# Download cygwin installer to be included by medley.iss | |
- name: Download cygwin installer | |
id: cygwin | |
shell: powershell | |
run: | | |
wget https://cygwin.com/setup-x86_64.exe -OutFile installers\cygwin\setup-x86_64.exe | |
# Download vnc viewer | |
#- name: Download vncviewer | |
# shell: powershell | |
# run: | | |
# $url = "https://sourceforge.net/projects/tigervnc/files/stable/1.12.0/vncviewer64-1.12.0.exe" | |
# $output = "installers\win\vncviewer64-1.12.0.exe" | |
# (New-Object System.Net.WebClient).DownloadFile($url, $output) | |
# Run iscc.exe to compile the installer | |
#- name: Compile medley.iss | |
# shell: powershell | |
# run: | | |
# iscc installers\win\medley.iss | |
# $filename="medley-install_${env:COMBINED_RELEASE_TAG}_x64.exe" | |
# echo "INSTALLER_FILENAME=$filename" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
# Run iscc.exe to compile the installer | |
- name: Compile cygwin_medley.iss | |
shell: powershell | |
run: | | |
iscc installers\cygwin\medley.iss | |
$filename="medley-full-${env:COMBINED_RELEASE_TAG}-cygwin-x86_64.exe" | |
echo "INSTALLER_FILENAME=$filename" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
# Upload windows installer to release | |
- name: Upload windows installer to release | |
id: push | |
uses: ncipollo/release-action@v1 | |
with: | |
allowUpdates: true | |
artifacts: installers/cygwin/${{ env.INSTALLER_FILENAME }} | |
tag: ${{ env.MEDLEY_RELEASE_TAG }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
omitBodyDuringUpdate: true | |
omitDraftDuringUpdate: true | |
omitNameDuringUpdate: true | |
omitPrereleaseDuringUpdate: true | |
# Install the OpenSSH Client | |
- name: Install the OpenSSH Client | |
shell: powershell | |
run: | | |
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0 | |
# Update the downloads page and the man page on OIO | |
- name: Update the downloads page and the man page to the OIO static page host | |
shell: bash | |
run: | | |
# Figure out filenames | |
download_url="${{ steps.push.outputs.html_url }}" | |
download_url="${download_url/\/tag\//\/download\/}" | |
local_template="installers/downloads_page/medley_downloads.html" | |
local_filename="medley_downloads.html" | |
local_manpath="docs/man-page/man_medley.html" | |
if [ "${{ needs.inputs.outputs.draft }}" = "true" ]; | |
then | |
remote_filename="draft_downloads" | |
remote_manname="man_draft.html" | |
else | |
remote_filename="${local_filename%.html}" | |
remote_manname="man_medley.html" | |
fi | |
remote_filepath="/srv/oio/static/${remote_filename}" | |
remote_manpath="/srv/oio/static/${remote_manname}" | |
# Fill in downloads page template | |
sed \ | |
-e "s/@@@MEDLEY.SHORT.RELEASE.TAG@@@/${MEDLEY_SHORT_RELEASE_TAG}/g" \ | |
-e "s~@@@DOWNLOAD_URL@@@~${download_url}~g" \ | |
-e "s/@@@DEBS.FILENAME.BASE@@@/${DEBS_FILENAME_BASE}/g" \ | |
-e "s/@@@WINDOWS.INSTALLER.FILENAME@@@/${INSTALLER_FILENAME}/g" \ | |
< "${local_template}" > "${local_filename}" | |
# Create sftp instruction file | |
echo "-rm ${remote_filepath}.oldold" > batch | |
echo "-rename ${remote_filepath}.old ${remote_filepath}.oldold" >> batch | |
echo "-rename ${remote_filepath}.html ${remote_filepath}.old" >> batch | |
echo "-put ${local_filename} ${remote_filepath}.html" >> batch | |
echo "-put ${local_manpath} ${remote_manpath}" >> batch | |
# Do the sftp | |
eval $(ssh-agent) | |
ssh-add - <<< "${SSH_KEY}" | |
sftp -o StrictHostKeyChecking=no -b batch [email protected] | |
env: | |
SSH_KEY: ${{ secrets.OIO_SSH_KEY }} | |
###################################################################################### | |
# Use set-sentry-action to determine set the sentry that says this release has | |
# been successfully built | |
complete: | |
runs-on: ubuntu-latest | |
outputs: | |
build_successful: ${{ steps.output.outputs.build_successful }} | |
needs: [inputs, sentry, loadup, windows_installer] | |
steps: | |
# Checkout the actions for this repo owner | |
- name: Checkout Actions | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ github.repository_owner }}/.github | |
path: ./Actions_${{ github.sha }} | |
- run: mv ./Actions_${{ github.sha }}/actions ../actions && rm -rf ./Actions_${{ github.sha }} | |
# Set sentry | |
- name: Set flag that build for this commit has been completed | |
id: set | |
uses: ./../actions/set-sentry-action | |
with: | |
tag: "loadup" | |
- name: Output | |
id: output | |
run: | | |
echo "build_successful='true'" >> $GITHUB_OUTPUT | |
###################################################################################### | |
# - name: Download the Windows installer created in windows job | |
# uses: actions/download-artifact@v3 | |
# with: | |
# name: windows_installer | |
# path: installers/win | |
# - name: Rename the Windows installer w/ version tag | |
# run: | | |
# maiko_release_tag="${{ steps.maiko.outputs.latest_tag }}" | |
# combined_release_tag="${MEDLEY_RELEASE_TAG#medley-}_${maiko_release_tag#maiko-}" | |
# windows_installer_filename="medley_install_${combined_release_tag}_x64.exe" | |
# cd installers/win | |
# mv medley_install_vXXXVERSIONXXX_x64.exe "${windows_installer_filename}" | |
# echo "WINDOWS_INSTALLER_FILENAME=${windows_installer_filename}" >>${GITHUB_ENV} | |