Skip to content

Commit

Permalink
Merge pull request #1 from geoffroymontel/main
Browse files Browse the repository at this point in the history
Add Github Actions to automatically build plugin, thanks Mads Kjeldgaard
  • Loading branch information
elgiano authored Nov 12, 2021
2 parents f0af995 + 405663a commit ffc1701
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 2 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
on:
push

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 XPlayBuf-${{runner.os}} install/XPlayBuf

# 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\XPlayBuf" -ArchiveFileName "XPlayBuf-${{runner.os}}.zip" -Format Zip

- name: Check if release has been created
uses: mukunku/[email protected]
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: XPlayBuf-${{ 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/XPlayBuf-${{runner.os}}.zip
asset_name: XPlayBuf-${{runner.os}}.zip
tag: ${{ github.ref }}
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.vimrc

build*
.DS_Store
/build*

0 comments on commit ffc1701

Please sign in to comment.