Skip to content

Commit

Permalink
Github Actions Release Stage (#7741)
Browse files Browse the repository at this point in the history
Move the nighly build to github actions. Have framework
for the release build but leave that on azure for a moment still.
Adjust all the various things which make surge special like
the version and website, but use as much of the shared actions
stuff as possible (which is most of it!)
  • Loading branch information
baconpaul committed Aug 7, 2024
1 parent c914d3b commit 7ad9513
Show file tree
Hide file tree
Showing 4 changed files with 274 additions and 28 deletions.
259 changes: 259 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,259 @@
name: Build Release or Nightly Installer
on:
workflow_dispatch:
push:
branches:
- main
tags:
- 'release_xt_**'

defaults:
run:
shell: bash

jobs:
surge_version:
name: Set up surge version
runs-on: ubuntu-latest
outputs:
surge_version: ${{ steps.vers.outputs.surge_version}}
surge_is_nightly: ${{ steps.vers.outputs.surge_is_nightly}}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: calculate version
id: vers
run: |
ref=${{ github.ref }}
echo "## Creating version from '${ref}'" >> $GITHUB_STEP_SUMMARY
if [[ "$ref" == "refs/heads/main" ]]; then
echo "Generating Nightly Version" >> $GITHUB_STEP_SUMMARY
export SURGE_VERSION="NIGHTLY-$(date +%Y-%m-%d)-$(git rev-parse --short HEAD)"
echo "surge_is_nightly=1" >> "$GITHUB_OUTPUT"
else
echo "Generating Release Version" >> $GITHUB_STEP_SUMMARY
tagv=${ref/refs\/tags\/release_xt_}
export SURGE_VERSION=${tagv}
echo "surge_is_nightly=0" >> "$GITHUB_OUTPUT"
fi
echo "SURGE_VERSION=${SURGE_VERSION}" >> $GITHUB_STEP_SUMMARY
echo "surge_version=${SURGE_VERSION}" >> "$GITHUB_OUTPUT"
build_plugin:
name: Release Build - ${{ matrix.name }}
runs-on: ${{ matrix.os }}
needs: [ surge_version ]
strategy:
matrix:
include:
- os: windows-latest
name: windows-64bit
cmakeArgs: -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang
- os: windows-latest
name: windows-32bit
cmakeArgs: -A Win32
- os: macos-latest
name: macos
cmakeArgs: -D"CMAKE_OSX_ARCHITECTURES=arm64;x86_64"
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- uses: apple-actions/import-codesign-certs@v3
if: runner.os == 'macOS'
with:
p12-file-base64: ${{ secrets.MAC_CERTS_P12 }}
p12-password: ${{ secrets.CERT_PWD }}

- name: Prepare for JUCE
uses: surge-synthesizer/sst-githubactions/prepare-for-juce@main
with:
os: ${{ runner.os }}


- name: Build release version
run: |
export MAC_SIGNING_CERT="${{ secrets.MAC_SIGNING_CERT_NAME }}"
export MAC_INSTALLING_CERT="${{ secrets.MAC_INSTALLING_CERT_NAME }}"
export MAC_SIGNING_ID="${{ secrets.MAC_SIGNING_ID }}"
export MAC_SIGNING_1UPW="${{ secrets.MAC_SIGNING_1UPW }}"
export MAC_SIGNING_TEAM="${{ secrets.MAC_SIGNING_TEAM }}"
export SURGE_VERSION="${{ needs.surge_version.outputs.surge_version }}"
cmake -S . -B ./build -DAZURE_PIPELINE=1 -DSURGE_VERSION="${{ needs.surge_version.outputs.surge_version }}" -DCMAKE_BUILD_TYPE=Release ${{ matrix.cmakeArgs }}
cmake --build ./build --config Release --target surge-xt-distribution --parallel 3
- name: Show Installer Directory
run: |
ls -l ./build/surge-xt-dist
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
path: build/surge-xt-dist
name: build-${{ matrix.name }}

build_plugin_docker:
name: Docker Build Ubuntu18
runs-on: ubuntu-latest
needs: [ surge_version ]

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Build in Docker
uses: surge-synthesizer/sst-githubactions/cmake-in-docker@main
with:
username: ${{ github.actor }}
token: ${{ secrets.GITHUB_TOKEN }}
cmakeArgs: -DAZURE_PIPELINE=1 -DSURGE_BUILD_LV2=TRUE -DSURGE_VERSION="${{ needs.surge_version.outputs.surge_version }}" -DCMAKE_BUILD_TYPE=Release -GNinja
target: surge-xt-distribution


- name: Show Installer Directory
run: |
ls -l ./build/surge-xt-dist
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
path: build/surge-xt-dist
name: build-docker

publish-surge-nightly:
name: Publish Surge Nightly
if: ${{ github.ref == 'refs/heads/main' && github.repository_owner == 'surge-synthesizer' }}
runs-on: ubuntu-latest
needs: [ build_plugin, build_plugin_docker ]
steps:
- name: Upload to Nightly
uses: surge-synthesizer/sst-githubactions/upload-to-release@main
with:
tag: Nightly
reuse_tag: true
create_tag: false
token: ${{ secrets.GITHUB_TOKEN }}
release_blurb_file: resources/NightlyBlurb.md

- name: Post to Discord
uses: surge-synthesizer/sst-githubactions/discord-release-notify@main
with:
webhook: ${{ secrets.DISCORD_SURGE_WEBHOOK }}
tag: Nightly
title: "A New Surge Nightly is Available"


publish-surge-release:
name: Publish Surge Release
if: startsWith(github.ref, 'refs/tags/v') && github.repository_owner == 'surge-synthesizer'
runs-on: ubuntu-latest
needs: [ build_plugin, build_plugin_docker ]
steps:
- name: Upload to Release
uses: surge-synthesizer/sst-githubactions/upload-to-release@main
with:
tag: ${{ github.ref_name }}
reuse_tag: false
create_tag: true
token: ${{ secrets.GITHUB_TOKEN }}

- name: Post to Discord
uses: surge-synthesizer/sst-githubactions/discord-release-notify@main
with:
webhook: ${{ secrets.DISCORD_SURGE_WEBHOOK }}
tag: ${{ github.ref_name }}
title: "A New Surge Release is Available"
subtitle: "Release ${{ github.ref_name }}"

create_web_links:
name: Create Website Links
runs-on: ubuntu-latest
needs: [ surge_version, build_plugin, build_plugin_docker ]
steps:
- name: checkout for git info
uses: actions/checkout@v4
if: ${{ needs.surge_version.outputs.surge_is_nightly == 1 }}
with:
path: surge
fetch-depth: 5

- name: Checkout web
uses: actions/checkout@v4
with:
path: web
repository: surge-synthesizer/surge-synthesizer.github.io
token: ${{ secrets.SURGE_GITHUB_IO_TOKEN }}

- name: make nightly git info
if: ${{ needs.surge_version.outputs.surge_is_nightly == 1 }}
run: |
mkdir -p stage_git/git_info
pushd surge
git log -1 --pretty=format:'%h : %s - %an' > ../stage_git/git_info/git_nightly_xt_log_display
git log -1 --pretty=format:'%h : %s%n%aD%n%an%n%n%B' > ../stage_git/git_info/git_nightly_xt_log_long_display
git log -5 --pretty=format:'%h : %s - %an' > ../stage_git/git_info/git_nightly_xt_recent_five
git log -1 --pretty=format:'%h' > ../stage_git/git_info/git_nightly_xt_log_hash
popd
cat stage_git/git_info/*
- name: make nightly links
if: ${{ needs.surge_version.outputs.surge_is_nightly == 1 }}
run: |
# change this to cd website
cd web
SURGE_VERSION="${{ needs.surge_version.outputs.surge_version }}"
echo $(date "+%Y-%m-%d %H:%M:%S %Z") > src/assets/includes/latest_xt_build_time
echo $SURGE_VERSION > src/assets/includes/latest_xt_version
cp ../stage_git/git_info/* src/assets/includes
echo ${{ github.server_url }}/${{ github.repository }}/releases/download/Nightly/surge-xt-macOS-$SURGE_VERSION.dmg > src/assets/includes/latest_xt_macos_url
echo ${{ github.server_url }}/${{ github.repository }}/releases/download/Nightly/surge-xt-win64-$SURGE_VERSION-setup.exe > src/assets/includes/latest_xt_win_x64_url
echo ${{ github.server_url }}/${{ github.repository }}/releases/download/Nightly/surge-xt-win64-$SURGE_VERSION-pluginsonly.zip > src/assets/includes/latest_xt_win_x64_zip_url
echo ${{ github.server_url }}/${{ github.repository }}/releases/download/Nightly/surge-xt-win32-$SURGE_VERSION-setup.exe > src/assets/includes/latest_xt_win_x86_url
echo ${{ github.server_url }}/${{ github.repository }}/releases/download/Nightly/surge-xt-win32-$SURGE_VERSION-pluginsonly.zip > src/assets/includes/latest_xt_win_x86_zip_url
echo ${{ github.server_url }}/${{ github.repository }}/releases/download/Nightly/surge-xt-linux-x64-$SURGE_VERSION.deb > src/assets/includes/latest_xt_linux_x64_url
cat src/assets/includes/*
git config user.email "[email protected]"
git config user.name "baconpaul"
git add .
git commit -m "Update surge links for ${SURGE_VERSION} from github action"
git push origin master
- name: make release links
if: ${{ needs.surge_version.outputs.surge_is_nightly == 0 }}
run: |
mkdir -p src/assets/includes
SURGE_VERSION="${{ needs.surge_version.outputs.surge_version }}"
echo $(date "+%Y-%m-%d %H:%M:%S %Z") > src/assets/includes/stable_xt_build_time
echo $SURGE_VERSION > src/assets/includes/stable_xt_version
echo ${{ github.server_url }}/${{ github.repository }}/releases/download/$SURGE_VERSION/surge-xt-macOS-$SURGE_VERSION.dmg > src/assets/includes/stable_xt_macos_url
echo ${{ github.server_url }}/${{ github.repository }}/releases/download/$SURGE_VERSION/surge-xt-win64-$SURGE_VERSION-setup.exe > src/assets/includes/stable_xt_win_x64_url
echo ${{ github.server_url }}/${{ github.repository }}/releases/download/$SURGE_VERSION/surge-xt-win64-$SURGE_VERSION-pluginsonly.zip > src/assets/includes/stable_xt_win_x64_zip_url
echo ${{ github.server_url }}/${{ github.repository }}/releases/download/$SURGE_VERSION/surge-xt-win32-$SURGE_VERSION-setup.exe > src/assets/includes/stable_xt_win_x86_url
echo ${{ github.server_url }}/${{ github.repository }}/releases/download/$SURGE_VERSION/surge-xt-win32-$SURGE_VERSION-pluginsonly.zip > src/assets/includes/stable_xt_win_x86_zip_url
echo ${{ github.server_url }}/${{ github.repository }}/releases/download/$SURGE_VERSION/surge-xt-linux-x64-$SURGE_VERSION.deb > src/assets/includes/stable_xt_linux_x64_url
echo ${{ github.server_url }}/${{ github.repository }}/releases/tag/$SURGE_VERSION > src/assets/includes/stable_xt_other.url
28 changes: 1 addition & 27 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,10 @@
# https://aka.ms/yaml

trigger:
- main
- xt-alpha
- release-xt/*

pr:
- main
- release-xt/*

jobs:
- job: BuildCodeQuality
pool:
vmImage: 'ubuntu-20.04'

steps:
- checkout: self
fetchDepth: 1
# submodules: recursive # can't do submodules here b'cuz depth=1 fails with Github

- bash: |
mkdir ignore
pushd ignore
git clone https://github.com/jidicula/clang-format-action
popd
./ignore/clang-format-action/check.sh 16 src llvm
displayName: Do Codequal
- job: NotifyReleases
dependsOn: BuildCodeQuality
condition: and(succeeded(), not(eq(variables['Build.Reason'], 'PullRequest')))
pool:
vmImage: 'ubuntu-20.04'

Expand All @@ -52,7 +26,7 @@ jobs:
# remove refs/heads/
export BRANCH="${BUILD_SOURCEBRANCH/refs\/heads\/}"
if ! [[ $BRANCH =~ ^(main|release-xt/.+)$ ]]; then
if ! [[ $BRANCH =~ ^(release-xt/.+)$ ]]; then
exit
fi
Expand Down
7 changes: 7 additions & 0 deletions resources/NightlyBlurb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## SurgeXT Nightly Release

This is the nightly release of SurgeXT. Surge nightlies are usually pretty stable, but they may contain bugs or incomplete features. Please use caution running this beta software.

If you want a stable production release, you can always find the latest stable release at [the Surge Website](https://surge-synthesizer.github.io)

In addition to these nightlies, we generate nightlies for a variety of flavors of Linux using [OpenBuildService](https://software.opensuse.org//download.html?project=home%3Asurge-synth-team&package=surge-xt-nightly)
8 changes: 7 additions & 1 deletion src/cmake/lib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,16 @@ function(surge_make_installers)
set(SURGE_XT_DIST_OUTPUT_DIR ${CMAKE_BINARY_DIR}/surge-xt-dist)
file(MAKE_DIRECTORY ${SURGE_XT_DIST_OUTPUT_DIR})

set(SXTVER $ENV{SURGE_VERSION})
if (DEFINED SURGE_VERSION)
set (SXTVER ${SURGE_VERSION})
else()
set(SXTVER $ENV{SURGE_VERSION})
endif()

if("${SXTVER}" STREQUAL "")
set(SXTVER "LOCAL")
endif()
message(STATUS "Installer Surge Version is ${SXTVER}")

function(run_installer_script PATH)
add_custom_command(TARGET surge-xt-distribution
Expand Down

0 comments on commit 7ad9513

Please sign in to comment.