1
0
mirror of synced 2026-01-25 12:05:41 +00:00

Change github workflows to provide MacOs full release zip file (#1290)

This commit is contained in:
Frank Halasz
2023-09-17 23:03:18 -07:00
committed by GitHub
parent b819e18c64
commit 02665ca91b
37 changed files with 3614 additions and 274 deletions

View File

@@ -60,7 +60,7 @@ defaults:
jobs:
######################################################################################
# JOB: inputs #######################################################################
# Regularize the inputs so they can be referenced the same way whether they are
# the result of a workflow_dispatch or a workflow_call
@@ -85,8 +85,7 @@ jobs:
fi
######################################################################################
# JOB: sentry #######################################################################
# Use sentry-action to determine if this release has already been built
# based on the latest commit to the repo
@@ -114,11 +113,11 @@ jobs:
with:
tag: "loadup"
######################################################################################
# JOB: loadup #######################################################################
#
# Do the loadup
# Do the loadup and push to release on github
#
loadup:
@@ -129,7 +128,8 @@ jobs:
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 }}
artifacts_filename_template: ${{ steps.job_outputs.outputs.ARTIFACTS_FILENAME_TEMPLATE }}
release_url: ${{ steps.push.outputs.html_url }}
needs: [inputs, sentry]
if: |
@@ -156,22 +156,35 @@ jobs:
# Get Maiko release information, retrieves the name of the latest
# release. Used to download the correct Maiko release
- name: Get Maiko Release Information
# Find latest release (draft or normal)
- name: Get maiko release information
id: maiko
uses: abatilo/release-info-action@v1.3.2
with:
owner: ${{ github.repository_owner }}
repo: maiko
run: |
tag=""
if [ "${{ needs.inputs.outputs.draft }}" = "true" ];
then
gh release list --repo ${{ github.repository_owner }}/maiko | grep Draft >/tmp/releases-$$
if [ $? -eq 0 ];
then
tag=$(head -n 1 /tmp/releases-$$ | awk '{ print $3 }')
fi
fi
if [ -z "${tag}" ];
then
tag=$(gh release list --repo ${{ github.repository_owner }}/maiko | grep Latest | head -n 1 | awk '{ print $3 }')
fi
echo "maiko_tag=${tag}" >> ${GITHUB_OUTPUT}
env:
GITHUB_TOKEN: ${{ secrets.MAIKO_TOKEN }}
# 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 "TARBALL_DIR=/tmp/tarballs" >>${GITHUB_ENV}
echo "MEDLEY_RELEASE_TAG=${RELEASE_TAG}" >>${GITHUB_ENV}
echo "MAIKO_RELEASE_TAG=${{ steps.maiko.outputs.latest_tag }}" >>${GITHUB_ENV}
echo "MAIKO_RELEASE_TAG=${{ steps.maiko.outputs.maiko_tag }}" >>${GITHUB_ENV}
echo "ARTIFACTS_FILENAME_TEMPLATE=medley-full-@@PLATFORM@@-@@ARCH@@-@@MEDLEY.RELEASE@@_@@MAIKO.RELEASE@@" >>${GITHUB_ENV}
- name: More Environment Variables
run: |
echo "MEDLEY_SHORT_RELEASE_TAG=${MEDLEY_RELEASE_TAG#medley-}" >>${GITHUB_ENV}
@@ -182,27 +195,25 @@ jobs:
- 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 "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 "ARTIFACTS_FILENAME_TEMPLATE=${ARTIFACTS_FILENAME_TEMPLATE}" >> ${GITHUB_OUTPUT}
# Setup some needed dirs in workspace
- name: Create work dirs
run: mkdir -p ${TARBALL_DIR}
# Download Maiko Release Assets
# Download Maiko Release Assets and untar it
- 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: "${{ env.MAIKO_RELEASE_TAG }}-linux.*.tgz"
- name: Untar Maiko Release for use in loadup
run: |
tar -xzf "${TARBALL_DIR}/${{ env.MAIKO_RELEASE_TAG }}-linux.x86_64.tgz"
gh release download ${MAIKO_RELEASE_TAG} \
-D ${TARBALL_DIR} \
--repo ${{ github.repository_owner }}/maiko \
-p '*.tgz'
tar -xzf "${TARBALL_DIR}/${MAIKO_RELEASE_TAG}-linux.x86_64.tgz"
env:
GITHUB_TOKEN: ${{ secrets.MAIKO_TOKEN }}
# Checkout Notecards and tar it in the tarballsdir
- name: Checkout Notecards
@@ -210,11 +221,11 @@ jobs:
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
mv ./notecards ../notecards
cd ../notecards
git archive --format=tgz --output="${TARBALL_DIR}/notecards.tgz" --prefix=notecards/ main
# Install vnc
- name: Install vnc
@@ -224,7 +235,6 @@ jobs:
run: |
Xvnc -geometry 1280x720 :0 &
export DISPLAY=":0"
PATH="$PWD/maiko:$PATH"
scripts/loadup-all.sh -apps
scripts/loadup-db.sh
@@ -233,15 +243,6 @@ jobs:
scripts/release-make-tars.sh "${MEDLEY_RELEASE_TAG}"
mv releases/"${MEDLEY_SHORT_RELEASE_TAG}"/*.tgz "${TARBALL_DIR}"
# 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
@@ -250,21 +251,166 @@ jobs:
continue-on-error: true
- name: Push the release
id: push_release
id: push
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts:
# ${{ env.TARBALL_DIR }}/notecards.tgz,
${{ 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
${{ env.TARBALL_DIR }}/${{ env.MEDLEY_RELEASE_TAG }}-runtime.tgz
tag: ${{ env.MEDLEY_RELEASE_TAG }}
draft: ${{ needs.inputs.outputs.draft }}
prerelease: false
generateReleaseNotes: true
token: ${{ secrets.GITHUB_TOKEN }}
# Save the tarball directory for subsequent jobs
- name: Save tarballs
uses: actions/upload-artifact@v3
with:
name: tarballs
path: ${{ env.TARBALL_DIR }}
if-no-files-found: error
# JOB: linux_installer ##############################################################
#
# Create the linux installers (.deb and .tgz) and push to release on github
#
linux_installer:
runs-on: ubuntu-latest
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
# Environment variables
- name: Environment variables
run: |
echo "DEBS_DIR=installers/deb/debs" >>${GITHUB_ENV}
echo "TARS_DIR=installers/deb/tars" >>${GITHUB_ENV}
echo "TARBALL_DIR=installers/deb/tmp/tarballs" >>${GITHUB_ENV}
echo "MEDLEY_RELEASE_TAG=${{ needs.loadup.outputs.medley_release_tag }}" \
>>${GITHUB_ENV}
echo "ARTIFACTS_FILENAME_TEMPLATE=${{ needs.loadup.outputs.artifacts_filename_template }}" >>${GITHUB_ENV}
# Create taball dir
- run: mkdir -p ${TARBALL_DIR}
# Get the tarballs
- name: Get tarballs
uses: actions/download-artifact@v3
with:
name: tarballs
path: ${{ env.TARBALL_DIR }}
# Build the deb files as well as the tgz files
- name: Build .deb files for 3 architectures
id: debs
run: |
cd installers/deb
./build_deb.sh
# Push the debs and tgz up to github releases
- name: Push the release
id: push_release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts:
${{ env.DEBS_DIR }}/*.deb,
${{ env.TARS_DIR }}/*.tgz
tag: ${{ env.MEDLEY_RELEASE_TAG }}
token: ${{ secrets.GITHUB_TOKEN }}
omitBodyDuringUpdate: true
omitDraftDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true
# JOB: macos_installer ##############################################################
#
# Create the macos installers (.dmg and .zip) and push to release on github
#
macos_installer:
runs-on: macos-12
needs: [inputs, sentry, loadup]
if: |
needs.sentry.outputs.release_not_built == 'true'
|| needs.inputs.outputs.force == 'true'
# if: false
defaults:
run:
shell: bash
steps:
# Checkout latest commit
- name: Checkout Medley
uses: actions/checkout@v3
# Environment variables
- name: Environment variables
run: |
MACOS_DIR=installers/macos
echo "MACOS_DIR=${MACOS_DIR}" >>${GITHUB_ENV}
echo "ARTIFACTS_DIR=${MACOS_DIR}/artifacts" >>${GITHUB_ENV}
echo "TARBALL_DIR=${MACOS_DIR}/tmp/tarballs" >>${GITHUB_ENV}
echo "MEDLEY_RELEASE_TAG=${{ needs.loadup.outputs.medley_release_tag }}" \
>>${GITHUB_ENV}
echo "ARTIFACTS_FILENAME_TEMPLATE=${{ needs.loadup.outputs.artifacts_filename_template }}" >>${GITHUB_ENV}
# Create tarball dir
- run: mkdir -p ${TARBALL_DIR}
# Get the tarballs
- name: Get tarballs
uses: actions/download-artifact@v3
with:
name: tarballs
path: ${{ env.TARBALL_DIR }}
# Build the .dmg and .zip files
- name: Build .dmg & .zip files
id: dmg-zip
run: |
cd ${MACOS_DIR}
./build_artifacts.sh
# Push the .dmg and .zip up to github releases
- name: Push the release
id: push_release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts:
# 2023-07-20 not yet building dmg -- ${{ env.ARTIFACTS_DIR }}/*.dmg,
${{ env.ARTIFACTS_DIR }}/*.zip
tag: ${{ env.MEDLEY_RELEASE_TAG }}
token: ${{ secrets.GITHUB_TOKEN }}
omitBodyDuringUpdate: true
omitDraftDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true
# JOB: windows_installer #############################################################
#
# Create the Windows installer, push it up to the release on github and
@@ -279,7 +425,11 @@ jobs:
needs.sentry.outputs.release_not_built == 'true'
|| needs.inputs.outputs.force == 'true'
outputs:
windows_installer_filename: ${{ steps.jobout.outputs.INSTALLER_FILENAME }}
steps:
# Checkout latest commit
- name: Checkout Medley
uses: actions/checkout@v3
@@ -294,8 +444,8 @@ jobs:
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
$aft="${{ needs.loadup.outputs.artifacts_filename_template }}"
echo "ARTIFACTS_FILENAME_TEMPLATE=$aft" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
# Download vnc viewer
- name: Download vncviewer
@@ -310,8 +460,7 @@ jobs:
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
# Upload windows installer to release
- name: Upload windows installer to release
@@ -319,7 +468,7 @@ jobs:
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: installers/win/${{ env.INSTALLER_FILENAME }}
artifacts: installers/win/medley-*.exe
tag: ${{ env.MEDLEY_RELEASE_TAG }}
token: ${{ secrets.GITHUB_TOKEN }}
omitBodyDuringUpdate: true
@@ -327,18 +476,63 @@ jobs:
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true
# Install the OpenSSH Client
- name: Install the OpenSSH Client
shell: powershell
# JOB: downloads_page ################################################################
#
# Update the downloads page on OIO
#
downloads_page:
runs-on: ubuntu-latest
needs: [inputs, sentry, loadup, linux_installer, macos_installer, windows_installer]
if: |
needs.sentry.outputs.release_not_built == 'true'
|| needs.inputs.outputs.force == 'true'
steps:
# Environment variables
- name: Environment Varibales (from other jobs)
run: |
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
crt="${{ needs.loadup.outputs.combined_release_tag }}"
echo "COMBINED_RELEASE_TAG=${crt}" >>${GITHUB_ENV}
mrt="${{ needs.loadup.outputs.medley_release_tag }}"
echo "MEDLEY_RELEASE_TAG=${mrt}" >>${GITHUB_ENV}
msrt="${{ needs.loadup.outputs.medley_short_release_tag }}"
echo "MEDLEY_SHORT_RELEASE_TAG=${msrt}" >>${GITHUB_ENV}
# Checkout latest commit
- name: Checkout Medley
uses: actions/checkout@v3
# Upload a dummy file to release
# Needed since download url of the release changes on every update
# So this will be the final update before creating downloads page
# and we can use its url for the page
- run: echo "placeholder" >placeholder.txt
- name: Upload windows installer to release
id: pushph
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: placeholder.txt
tag: ${{ env.MEDLEY_RELEASE_TAG }}
token: ${{ secrets.GITHUB_TOKEN }}
omitBodyDuringUpdate: true
omitDraftDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true
# 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="${{ steps.pushph.outputs.html_url }}"
download_url="${download_url/\/tag\//\/download\/}"
local_template="installers/downloads_page/medley_downloads.html"
local_filename="medley_downloads.html"
@@ -356,9 +550,8 @@ jobs:
# Fill in downloads page template
sed \
-e "s/@@@MEDLEY.SHORT.RELEASE.TAG@@@/${MEDLEY_SHORT_RELEASE_TAG}/g" \
-e "s/@@@COMBINED.RELEASE.TAG@@@/${COMBINED_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
@@ -375,7 +568,7 @@ jobs:
######################################################################################
# JOB: complete #####################################################################
# Use set-sentry-action to determine set the sentry that says this release has
# been successfully built
@@ -387,9 +580,16 @@ jobs:
outputs:
build_successful: ${{ steps.output.outputs.build_successful }}
needs: [inputs, sentry, loadup, windows_installer]
needs: [inputs, sentry, loadup, downloads_page]
steps:
# Delete the tarballs artifact
- name: Delete tarballs artifact
uses: geekyeggo/delete-artifact@v2
with:
name: tarballs
failOnError: false
# Checkout the actions for this repo owner
- name: Checkout Actions
uses: actions/checkout@v3
@@ -411,21 +611,4 @@ jobs:
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}
######################################################################################

View File

@@ -84,6 +84,7 @@ jobs:
echo "force=false" >> $GITHUB_OUTPUT;
fi
######################################################################################