#re******************************************************************************* # 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 by Interlisp.org # # ****************************************************************************** name: Build/Push Medley Release # Run this workflow on ... on: workflow_dispatch: inputs: 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: 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: force: ${{ steps.force.outputs.force }} steps: - id: force run: > if [ '${{ toJSON(inputs) }}' = 'null' ]; then echo ::set-output name=force::'${{ github.event.inputs.force }}'; echo "workflow_dispatch"; else echo ::set-output name=force::'${{ inputs.force }}'; echo "workflow_call"; 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@v2 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@v2 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@v2 # 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 ::set-output name=build_time::$(date -u +'%Y-%m-%dT%H:%M:%SZ') # Get Maiko release information, retrieves the name of the latest # release. Used to download the correct Maiko release - name: Get Maiko Release Information id: latest_version uses: abatilo/release-info-action@v1.3.0 with: owner: ${{ github.repository_owner }} repo: maiko # Download Maiko Release Assets - name: Download Release Assets uses: robinraju/release-downloader@v1.2 with: repository: ${{ github.repository_owner }}/maiko token: ${{ secrets.GITHUB_TOKEN }} latest: true fileName: "${{ steps.latest_version.outputs.latest_tag }}-linux.x86_64.tgz" - name: Untar Maiko Release run: | tar -xvzf "${{ steps.latest_version.outputs.latest_tag }}-linux.x86_64.tgz" - name: Install vnc run: sudo apt-get update && sudo apt-get install -y tightvncserver - name: Build Loadout run: | Xvnc -geometry 1280x720 :0 & export DISPLAY=":0" PATH="$PWD/maiko:$PATH" scripts/loadup-all.sh - name: Build loadups release tar run: | cp -p tmp/full.sysout tmp/lisp.sysout tmp/whereis.hash loadups/ cp -p tmp/exports.all library/ cd .. tar cfz medley/tmp/${release_tag}-loadups.tgz \ medley/loadups/lisp.sysout \ medley/loadups/full.sysout \ medley/loadups/whereis.hash \ medley/library/exports.all env: release_tag: ${{ steps.tag.outputs.release_tag }} - name: Build runtime release tar run: | cd .. tar cfz medley/tmp/${release_tag}-runtime.tgz \ --exclude "*~" --exclude "*#*" \ --exclude exports.all \ medley/docs/dinfo \ medley/doctools \ medley/greetfiles \ medley/rooms \ 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 env: release_tag: ${{ steps.tag.outputs.release_tag }} - name: "Create release" uses: "actions/github-script@v5" with: github-token: "${{ secrets.GITHUB_TOKEN }}" script: | try { await github.rest.repos.createRelease({ draft: false, generate_release_notes: true, name: process.env.release_tag, owner: context.repo.owner, prerelease: false, repo: context.repo.repo, tag_name: process.env.release_tag, }); } catch (error) { core.setFailed(error.message); } env: release_tag: ${{ steps.tag.outputs.release_tag }} - name: "Upload release assets" uses: AButler/upload-release-assets@v2.0 with: files: 'tmp/${{ env.release_tag }}-loadups.tgz;tmp/${{ env.release_tag }}-runtime.tgz' repo-token: ${{ secrets.GITHUB_TOKEN }} release-tag: ${{ env.release_tag }} env: release_tag: ${{ steps.tag.outputs.release_tag }} ###################################################################################### # 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@v2 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 ::set-output name=build_successful::'true' ######################################################################################