Skip to content

Instantly share code, notes, and snippets.

@madskjeldgaard

madskjeldgaard/build.yml

Last active Mar 4, 2021
Embed
What would you like to do?
Build, compile and release cross platform SuperCollider plugins using this Github Actions file. By adding this action, every time you push a new tag to your github repo containg `v*` GH will automatically compile and publish using that tag.
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
build:
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [macos-latest, ubuntu-18.04, windows-latest]
steps:
- uses: actions/checkout@v2
- name: Install 7Zip (Windows)
if: matrix.os == 'windows-latest'
shell: powershell
run: Install-Module 7Zip4PowerShell -Force -Verbose
- name: Get SC source code
run: git clone https://github.com/supercollider/supercollider.git ${{github.workspace}}/supercollider
- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake (Unix)
shell: bash
if: matrix.os != 'windows-latest'
working-directory: ${{github.workspace}}/build
run: cmake .. -DCMAKE_BUILD_TYPE='Release' -DSC_PATH=${{github.workspace}}/supercollider -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/install
- name: Configure CMake (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
working-directory: ${{github.workspace}}\build
run: cmake .. -DCMAKE_BUILD_TYPE='Release' -DSC_PATH=${{github.workspace}}\supercollider -DCMAKE_INSTALL_PREFIX=${{github.workspace}}\build\install
- name: Build (Unix)
if: matrix.os != 'windows-latest'
working-directory: ${{github.workspace}}/build
shell: bash
run: cmake --build . --config "Release" --target install
- name: Build (Windows)
working-directory: ${{github.workspace}}\build
if: matrix.os == 'windows-latest'
shell: pwsh
run: cmake --build . --config "Release" --target install
# Gather all files in a zip
- name: Zip up build (Unix)
if: matrix.os != 'windows-latest'
shell: bash
working-directory: ${{github.workspace}}/build
run: zip -r MKPlugins-${{runner.os}} install/MKPlugins
# Gather all files in a zip
- name: Zip up build (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
working-directory: ${{github.workspace}}\build
run: Compress-7Zip "install\MKPlugins" -ArchiveFileName "MKPlugins-${{runner.os}}.zip" -Format Zip
- name: Check if release has been created
uses: mukunku/tag-exists-action@v1.0.0
id: checkTag
with:
tag: 'v1'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Publish build
- name: Create Release
if: steps.checkTag.outputs.exists == false
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: MKPlugins-${{ github.ref }}
draft: false
prerelease: false
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{github.workspace}}/build/MKPlugins-${{runner.os}}.zip
asset_name: MKPlugins-${{runner.os}}.zip
tag: ${{ github.ref }}
@madskjeldgaard

This comment has been minimized.

Copy link
Owner Author

@madskjeldgaard madskjeldgaard commented Mar 3, 2021

Search and replace all MKPlugins asset names to change to whatever your project is called

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment