Skip to content

Commit

Permalink
Try new build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
brunchboy committed Feb 25, 2024
1 parent 0e28cf0 commit b212f45
Show file tree
Hide file tree
Showing 8 changed files with 132 additions and 64 deletions.
3 changes: 3 additions & 0 deletions .github/resources/preview_notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:construction: This is pre-release code for people who want to help test [what is going into the next release](https://github.com/Deep-Symmetry/beat-link-trigger/blob/master/CHANGELOG.md).

> Don’t download this if you aren’t comfortable testing code while it is under active development! Instead, look at the [latest release](https:///github.com/Deep-Symmetry/beat-link-trigger/releases/latest).
12 changes: 12 additions & 0 deletions .github/resources/release_notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
> If you came here from the link in the first [DJ TechTools article](http://djtechtools.com/2017/07/19/decoding-pioneer-pro-link-connect-cdjs-ableton-link/), please look at my [instructions](https://github.com/brunchboy/beat-link-trigger#beat-link-trigger) for more information about how to install and use Beat Link Trigger!
## What to Download

- If you already have a compatible Java runtime installed (Java 11 or later), you can just download the executable cross-platform Jar file, and should be able to run it by double-clicking.
- If you are on a Mac and don’t want to have to worry about installing and managing a separate Java environment, you can download the MacOS disk image (`.dmg`) file, which contains a signed, notarized Mac application with the necessary Java runtime built right in.
- If you are on 64-bit Windows and don’t want to have to separately install Java you can download the Win64 MSI installer (`.msi` file), which installs a Windows application with the Java runtime built in.
- If you want to test [what is going into the next release](https://github.com/Deep-Symmetry/beat-link-trigger/blob/master/CHANGELOG.md), look at the pre-release SNAPSHOT release (if any) at the [top of the full Releases list](https://github.com/Deep-Symmetry/beat-link-trigger/releases).

## What’s in the Release

✨Summary to be added once James has a moment! Please see the [Change Log](https://github.com/Deep-Symmetry/beat-link-trigger/blob/main/CHANGELOG.md#730---2023-11-24) for all the details.
16 changes: 13 additions & 3 deletions .github/scripts/build_dmg.zsh
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Fail if any step fails
set -e

# Move the downloaded cross-platform executable Jar into an Input folder to be used in building the
# native app bundle.
# Download the executable jar into an Input folder to be used in building the native app bundle
mkdir Input
mv $uberjar_name Input/beat-link-trigger.jar
if [ "$release_snapshot" = true ] ; then
gh release download latest-preview --pattern "*.jar" --output Input/beat-link-trigger.jar
else
gh release download "$release_tag" --pattern "*.jar" --output Input/beat-link-trigger.jar
fi

# See if the secrets needed to code-sign the native application are present.
if [ "$IDENTITY_PASSPHRASE" != "" ]; then
Expand Down Expand Up @@ -53,3 +56,10 @@ fi

# Rename the disk image to the name we like to use for the release artifact.
mv "$dmg_name" "$artifact_name"

# Upload the disk image as a release artifact
if [ "$release_snapshot" = true ] ; then
gh release upload latest-preview "$artifact_name#macOS disk image"
else
gh release upload $release_tag "$artifact_name#macOS disk image"
fi
22 changes: 19 additions & 3 deletions .github/scripts/build_msi.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,16 @@ if (!(Test-Path $Light)) {
Write-Warning "Light location not found, please check if Wix-Toolset is installed correctly"
}

# Move the downloaded cross-platform executable Jar into an Input folder to be used in building the
# native app bundle.
# Download the executable jar into an Input folder to be used in building the native app bundle
mkdir Input
copy "$env:uberjar_name" Input/beat-link-trigger.jar
if ( $env:release_snapshot )
{
gh release download latest-preview --pattern "*.jar" --output Input/beat-link-trigger.jar
}
else
{
gh release download $env:release_tag --pattern "*.jar" --output Input/beat-link-trigger.jar
}

# Build the native application bundle and installer.
jpackage --name "$env:blt_name" --input .\Input --add-modules "$env:blt_java_modules" `
Expand All @@ -47,3 +53,13 @@ copy ".\.github\resources\MSI Template.wxs" ".\"

#Compile MSI
& $Light -b "Beat Link Trigger" -nologo "*.wixobj" -out ""$env:artifact_name"" -ext WixUIExtension -ext WixFirewallExtension

# Upload the MSI as a release artifact
if ( $env:release_snapshot )
{
gh release upload latest-preview "$($env:artifact_name)#Windows installer"
}
else
{
gh release upload $env:release_tag "$($env:artifact_name)#Windows installer"
}
29 changes: 29 additions & 0 deletions .github/scripts/create_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

set -e # Exit if any command fails.

# See if we are creating a preview release
if [ "$release_snapshot" = true ] ; then

# Create (or move) the latest-preview tag locally, then push it.
echo "Creating tag for preview release"
git config --global user.name 'James Elliott'
git config --global user.email '[email protected]'
git tag latest-preview -m "The latest preview release" --force
git push --tags

# Actually create the preview release and upload the cross-platform Jar
echo "Creating preview release"
gh release create latest-preview "$uberjar_name#Cross-platform Jar" --prerelease \
--title "Preview release being built" \
--notes ":construction: This release is currently being built by GitHub Actions. Come back in a few minutes."

else

# Actually create the release and upload the cross-platform Jar
echo "Creating final release"
gh release create "$release_tag" "$uberjar_name#Cross-platform Jar" --prerelease \
--title "Release being built" \
--notes ":construction: This release is currently being built by GitHub Actions. Come back in a few minutes."

fi
21 changes: 21 additions & 0 deletions .github/scripts/delete_preview.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

set -e # Exit if any command fails.

# Check if the preview release exists.
if gh release view latest-preview --json assets --jq '.assets[].name' > preview_assets.txt ; then

echo "There is a preview release. Deleting assets..."
while read -r asset; do
echo " Deleting asset $asset:"
gh release delete-asset latest-preview "$asset" --yes
done <preview_assets.txt

echo "Deleting the preview release itself:"
gh release delete latest-preview --cleanup-tag --yes

else
echo "No preview release found to clean up."
fi

rm -f preview_assets.txt
15 changes: 15 additions & 0 deletions .github/scripts/finish_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

set -e # Exit if any command fails.

# See if we are creating a preview release
if [ "$release_snapshot" = true ] ; then

gh release edit latest-preview --title "$release_tag preview" --notes-file .github/resources/preview_notes.md

else

gh release edit "$release_tag" --prerelease=false --title "$release_tag" \
--notes-file .github/resources/release_notes.md

fi
78 changes: 20 additions & 58 deletions .github/workflows/uberjar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ env:
blt_vendor_folder: Deep Symmetry
blt_icon: BeatLink.ico
blt_upgradecode: 6D58C8D7-6163-43C6-93DC-A4C8CC1F81B6
initial_description: |
:construction: This is pre-release code for people who want to help test [what is going into the next release](https://github.com/Deep-Symmetry/beat-link-trigger/blob/master/CHANGELOG.md).
> Don’t download this if you aren’t comfortable testing code while it is under active development! Instead, look at the [latest release](https:///github.com/Deep-Symmetry/beat-link-trigger/releases/latest).
:calendar: **Ignore the “release date” above!** Because this is a snapshot release, the executables below (you may need to click to expand the Assets) will change frequently—whenever new code is pushed to the project—so you will want to _download the latest version every time you work with one_. The date you see _on each asset row_ shows you when it was last updated. Source code archive assets are not useful for snapshot releases, they will always reflect the state of the project when the snapshots began. And you can always determine the exact and definitive build date, version, and the version of Java being used by opening the “About” window within BLT.

jobs:
build_uberjar:
Expand All @@ -35,6 +29,9 @@ jobs:
uses: actions/checkout@v4

- name: Install SSH Key
env:
found_ssh_key: ${{ secrets.GUIDE_SSH_KEY }}
if: ${{ env.found_ssh_key != '' }}
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.GUIDE_SSH_KEY }}
Expand Down Expand Up @@ -80,17 +77,13 @@ jobs:
lein uberjar
mv target/beat-link-trigger.jar "./$uberjar_name"
- name: Upload überjar
- name: Delete any pre-existing preview release
if: success()
uses: Xotl/cool-github-releases@v1
with:
mode: update
tag_name: ${{ env.release_tag }}
isPrerelease: ${{ env.release_snapshot }}
replace_assets: ${{ env.release_snapshot }}
assets: ${{ env.uberjar_name }}
github_token: ${{ github.token }}
initial_mrkdwn: ${{ env.initial_description }}
run: bash .github/scripts/delete_preview.sh

- name: Create release and upload überjar
if: success()
run: bash .github/scripts/create_release.sh

- name: Cache htmltest results
uses: actions/cache@v4
Expand Down Expand Up @@ -139,31 +132,9 @@ jobs:
java-version: '17'
distribution: 'corretto'

- name: Download überjar
uses: Xotl/cool-github-releases@v1
with:
mode: download
tag_name: ${{ env.release_tag }}
assets: ${{ env.uberjar_name }}
github_token: ${{ github.token }}

- name: Build Windows Installer
run: .\.github\scripts\build_msi.ps1

- name: Upload Windows MSI
if: success()
uses: Xotl/cool-github-releases@v1
with:
mode: update
tag_name: ${{ env.release_tag }}
release_name: "${{ env.release_tag }} builds"
isPrerelease: ${{ env.release_snapshot }}
replace_assets: ${{ env.release_snapshot }}
assets: ${{ env.artifact_name }}
github_token: ${{ github.token }}
initial_mrkdwn: ${{ env.initial_description }}


build_dmg:
name: Build macOS Disk Image
runs-on: macos-latest
Expand Down Expand Up @@ -201,30 +172,21 @@ jobs:
java-version: '17'
distribution: 'corretto'

- name: Download überjar
uses: Xotl/cool-github-releases@v1
with:
mode: download
tag_name: ${{ env.release_tag }}
replace_assets: ${{ env.release_snapshot }}
assets: ${{ env.uberjar_name }}
github_token: ${{ github.token }}
initial_mrkdwn: ${{ env.initial_description }}

- name: Build macOS disk image
env:
IDENTITY_PASSPHRASE: ${{ secrets.IDENTITY_PASSPHRASE }}
IDENTITY_P12_B64: ${{ secrets.IDENTITY_P12_B64 }}
NOTARIZATION_PW: ${{ secrets.NOTARIZATION_PW }}
run: zsh .github/scripts/build_dmg.zsh

- name: Upload macOS disk image
if: success()
uses: Xotl/cool-github-releases@v1
with:
mode: update
tag_name: ${{ env.release_tag }}
replace_assets: ${{ env.release_snapshot }}
assets: ${{ env.artifact_name }}
github_token: ${{ github.token }}
initial_mrkdwn: ${{ env.initial_description }}
finish_release:
name: Finish the release
runs-on: ubuntu-latest

needs:
build_dmg
build_msi

steps:
- name: Update release title, description, and status
run: bash .github/scripts/rinish_release.sh

0 comments on commit b212f45

Please sign in to comment.