#******************************************************************************* # 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' 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 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 # Setup environment variables - name: Setup Environment Variables id: setup_env 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} # Setup some needed dirs in workspace - name: Create work dirs run: mkdir -p ${TARBALL_DIR} # Get Maiko release information, retrieves the name of the latest # release. Used to download the correct Maiko release - name: Get Maiko Release Information id: maiko uses: abatilo/release-info-action@v1.3.2 with: owner: ${{ github.repository_owner }} repo: maiko # Download Maiko Release Assets - name: Download Release Assets uses: robinraju/release-downloader@v1.6 with: repository: ${{ github.repository_owner }}/maiko token: ${{ secrets.GITHUB_TOKEN }} latest: true out-file-path: ${{ env.TARBALL_DIR }} fileName: "${{ steps.maiko.outputs.latest_tag }}-linux.*.tgz" - name: Untar Maiko Release for use in loadup run: | tar -xzf "${TARBALL_DIR}/${{ steps.maiko.outputs.latest_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 # - 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 - name: Build .deb files for 3 architectures run: | cd installers/deb ./build_deb.sh - 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: Update the downloads page and the man page to the OIO satic page host run: | maiko_release_tag="${{ steps.maiko.outputs.latest_tag }}" medley_short_release_tag="${MEDLEY_RELEASE_TAG#medley-}" full_release_filename="${MEDLEY_RELEASE_TAG/medley/medley-full}_${maiko_release_tag#maiko-}" # Need info about where github stores assets because draft releases are not tagged release_url="${{ steps.push_release.outputs.html_url }}" github_subdir="$( echo "${release_url}" | sed -e "s#^.*/\([^/]\+\)\$#\1#g" )" # local_template="installers/downloads_page/medley_downloads.html" local_filename="medley_downloads.html" if [ "${{ needs.inputs.outputs.draft }}" = "true" ]; then remote_filename="draft_downloads" else remote_filename="${local_filename%.html}" fi remote_filepath="/srv/oio/static/${remote_filename}" sed \ -e "s/@@@FULL.RELEASE.FILENAME@@@/${full_release_filename}/g" \ -e "s/@@@GITHUB.SUBDIR@@@/${github_subdir}/g" \ -e "s/@@@MEDLEY.SHORT.RELEASE.TAG@@@/${medley_short_release_tag}/g" \ < "${local_template}" > "${local_filename}" local_manpath="docs/man-page/man_medley.html" remote_manpath="/srv/oio/static/man_medley.html" 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 eval $(ssh-agent) ssh-add - <<< "${SSH_KEY}" sftp -o StrictHostKeyChecking=no -b batch ubuntu@online.interlisp.org 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] 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 ######################################################################################